Lisp HUG Maillist Archive

:initial-focus initarg for interfaces

I'm not sure I fully understand how the :initial-focus initarg for
interfaces is supposed to be used.  If I'm doing it like in the
example code below I get an error message.

According to the manual, "a symbol naming a pane" is OK.  What am I missing?

Thanks,
Edi.


(in-package :cl-user)

(capi:define-interface test-interface ()
  ()
  (:panes
   (main-pane
    capi:output-pane)
   (button
    capi:push-button
    :text "Whatever"))
  (:layouts
   (main-layout
    capi:column-layout
    '(main-pane button)))
  (:default-initargs
   :initial-focus 'main-pane))

(defun test ()
  (capi:display (make-instance 'test-interface)))

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: :initial-focus initarg for interfaces

Hmm, same error here (LWW), too.
 
If I change it to ":initial-focus 'button", then there's no error.
 
And then there's this caveat in the doc for pane-initial-focus:
 
"(setf pane-initial-focus) may be used to set the initial focus pane, but only before pane-with-children has been created. If the setter is called after pane-with-children has been created, an error is signalled."
 
pt
 


On Sun, Jan 27, 2013 at 11:43 AM, Edi Weitz <edi@weitz.de> wrote:

I'm not sure I fully understand how the :initial-focus initarg for
interfaces is supposed to be used.  If I'm doing it like in the
example code below I get an error message.

According to the manual, "a symbol naming a pane" is OK.  What am I missing?

Thanks,
Edi.


(in-package :cl-user)

(capi:define-interface test-interface ()
  ()
  (:panes
   (main-pane
    capi:output-pane)
   (button
    capi:push-button
    :text "Whatever"))
  (:layouts
   (main-layout
    capi:column-layout
    '(main-pane button)))
  (:default-initargs
   :initial-focus 'main-pane))

(defun test ()
  (capi:display (make-instance 'test-interface)))

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: :initial-focus initarg for interfaces

On Sun, Jan 27, 2013 at 6:57 PM, paul tarvydas <paultarvydas@gmail.com> wrote:

> If I change it to ":initial-focus 'button", then there's no error.

Strange.

> "(setf pane-initial-focus) may be used to set the initial focus pane, but
> only before pane-with-children has been created. If the setter is called
> after pane-with-children has been created, an error is signalled."

I would have hoped that the CAPI code took care of this if I'm allowed
to provide this initarg...

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: :initial-focus initarg for interfaces

The code below does not raise an error.
 
I'd guess that a plain-jane output-pane does not qualify for getting focus, hence, the error.  As soon as I added an input-model, it worked (there are probably a number of other things you could do with an output-pane that make it focus-able).
 
pt
 
 
(in-package :cl-user)
 
(defun draw-input (self x y gspec)
  (let ((data (sys:gesture-spec-data gspec))
        (mods (sys:gesture-spec-modifiers gspec)))
    (gp:draw-string
     self
     (with-output-to-string (ss)
       (sys:print-pretty-gesture-spec
        gspec ss :force-shift-for-upcase nil))
     x y))) 

(capi:define-interface test-interface ()
   ()
   (:panes
    (main-pane
     capi:output-pane
     :input-model '((:gesture-spec draw-input)))
    (button
     capi:push-button
     :text "Whatever"))
   (:layouts
    (main-layout
     capi:column-layout
     '(main-pane button)))
   (:default-initargs
    :initial-focus 'main-pane))
 
(defun test ()
  (capi:display (make-instance 'test-interface)))



On Sun, Jan 27, 2013 at 1:04 PM, Edi Weitz <edi@weitz.de> wrote:
On Sun, Jan 27, 2013 at 6:57 PM, paul tarvydas <paultarvydas@gmail.com> wrote:

> If I change it to ":initial-focus 'button", then there's no error.

Strange.

> "(setf pane-initial-focus) may be used to set the initial focus pane, but
> only before pane-with-children has been created. If the setter is called
> after pane-with-children has been created, an error is signalled."

I would have hoped that the CAPI code took care of this if I'm allowed
to provide this initarg...

Re: :initial-focus initarg for interfaces

Paul, thanks for digging into this.  The funny thing is that the code
where I originally saw these problems had an output pane WITH an input
model and it still didn't work.  I believe there's some other issue
involved...

On Sun, Jan 27, 2013 at 7:59 PM, paul tarvydas <paultarvydas@gmail.com> wrote:
> The code below does not raise an error.
>
> I'd guess that a plain-jane output-pane does not qualify for getting focus,
> hence, the error.  As soon as I added an input-model, it worked (there are
> probably a number of other things you could do with an output-pane that make
> it focus-able).
>
> pt
>
>
> (in-package :cl-user)
>
> (defun draw-input (self x y gspec)
>   (let ((data (sys:gesture-spec-data gspec))
>         (mods (sys:gesture-spec-modifiers gspec)))
>     (gp:draw-string
>      self
>      (with-output-to-string (ss)
>        (sys:print-pretty-gesture-spec
>         gspec ss :force-shift-for-upcase nil))
>      x y)))
>
> (capi:define-interface test-interface ()
>    ()
>    (:panes
>     (main-pane
>      capi:output-pane
>      :input-model '((:gesture-spec draw-input)))
>
>     (button
>      capi:push-button
>      :text "Whatever"))
>    (:layouts
>     (main-layout
>      capi:column-layout
>      '(main-pane button)))
>    (:default-initargs
>     :initial-focus 'main-pane))
>
> (defun test ()
>   (capi:display (make-instance 'test-interface)))
>
>
>
> On Sun, Jan 27, 2013 at 1:04 PM, Edi Weitz <edi@weitz.de> wrote:
>>
>> On Sun, Jan 27, 2013 at 6:57 PM, paul tarvydas <paultarvydas@gmail.com>
>> wrote:
>>
>> > If I change it to ":initial-focus 'button", then there's no error.
>>
>> Strange.
>>
>> > "(setf pane-initial-focus) may be used to set the initial focus pane,
>> > but
>> > only before pane-with-children has been created. If the setter is called
>> > after pane-with-children has been created, an error is signalled."
>>
>> I would have hoped that the CAPI code took care of this if I'm allowed
>> to provide this initarg...
>
>

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


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