Lisp HUG Maillist Archive

:DEFAULT-P vs. focus

If I create a dialog like below, the ESC and RETURN keys cease to work
as expected although :DEFAULT-P and :CANCEL-P are used.  This is
obviously due to setting the focus to the pinboard layout.

Is there a way to code around this?

Thanks,
Edi.



(defun foo ()
  (let* ((pinboard (make-instance 'capi:pinboard-layout))
         (ok-button (make-instance 'capi:push-button
                                   :default-p t
                                   :text "OK"
                                   :callback-type :none
                                   :callback (lambda ()
                                               (capi:exit-dialog :ok))))
         (cancel-button (make-instance 'capi:push-button
                                       :cancel-p t
                                       :text "Cancel"
                                       :callback #'capi:abort-dialog))
         (layout (make-instance 'capi:row-layout
                                :description (list pinboard ok-button cancel-button)))
         (dialog (make-instance 'capi:interface
                                :title "Test"
                                :layout layout
                                :create-callback (lambda (interface)
                                                   (declare (ignore interface))
                                                   (capi:set-pane-focus pinboard)))))
    (capi:display-dialog dialog)))


Re: :DEFAULT-P vs. focus

Unable to parse email body. Email id is 5253

Re: :DEFAULT-P vs. focus

On Tue, 24 Jan 2006 18:58:02 GMT, davef@lispworks.com wrote:

> Perhaps I am missing something obvious but you could set the focus
> to the OK button.

Sure, this was just to illustrate the problem.  In my application I
have an interface with a pinboard layout and OK and Cancel buttons.
As soon as the user does something in the pinboard layout, the layout
has the focus, and at that point RETURN and ESC no longer work.


Re: :DEFAULT-P vs. focus

Did you try to set the accepts-focus initarg to NIL on the pinboard-layout ?

(defun foo ()
  (let* ((pinboard (make-instance 'capi:pinboard-layout :accepts-focus-p
nil))
         (ok-button (make-instance 'capi:push-button
                                   :default-p t
                                   :text "OK"
                                   :callback-type :none
                                   :callback (lambda ()
                                               (capi:exit-dialog :ok))))
         (cancel-button (make-instance 'capi:push-button
                                       :cancel-p t
                                       :text "Cancel"
                                       :callback #'capi:abort-dialog))
         (layout (make-instance 'capi:row-layout
                                :description (list pinboard ok-button
cancel-button)))
         (dialog (make-instance 'capi:interface
                                :title "Test"
                                :layout layout)))

    ;For me the create-callback is unnecessary

    (capi:display-dialog dialog :focus OK-BUTTON)))


Denis


Le 24/01/06 20:17, « Edi Weitz » <edi@agharta.de> a écrit :

> 
> On Tue, 24 Jan 2006 18:58:02 GMT, davef@lispworks.com wrote:
> 
>> Perhaps I am missing something obvious but you could set the focus
>> to the OK button.
> 
> Sure, this was just to illustrate the problem.  In my application I
> have an interface with a pinboard layout and OK and Cancel buttons.
> As soon as the user does something in the pinboard layout, the layout
> has the focus, and at that point RETURN and ESC no longer work.
> 
> 



----------------------------------------------------
Denis Pousseur
6 clos du Drossart
1180 Bruxelles, Belgique

Mail :  denis.pousseur@compositeurs.be
Website : http://compositeurs.be
----------------------------------------------------




Re: :DEFAULT-P vs. focus

On Tue, 24 Jan 2006 20:59:30 +0100, Denis Pousseur <denis.pousseur@compositeurs.be> wrote:

> Did you try to set the accepts-focus initarg to NIL on the
> pinboard-layout ?

No, I wouldn't have thought of that because to me (from my
understanding of the docs) it meant that the pinboard layout isn't
usable at all.  But it works - I can still use the pinboard layout and
the problem with the buttons is gone.  Thanks!

>     ;For me the create-callback is unnecessary

As I said to Dave, this was just to quickly illustrate the problem.

Thanks,
Edi.


Re: :DEFAULT-P vs. focus

On Tue, 24 Jan 2006 13:44:05 -0700, Wade Humeniuk <whumeniu@telus.net> wrote:

> How about the brute force method?

Thanks.  I thought of that but it turns out that Denis' hint solved my
immediate problem.

> Methinks that capi:interface has a method/function that can be
> called to programmatically make it handle an UI gesture.

Is it documented somewhere?

Thanks,
Edi.


Updated at: 2020-12-10 08:49 UTC