[cells-devel] Currently focused window

Andy Chambers achambers.home at googlemail.com
Sat Jul 11 22:16:00 UTC 2009


On Sat, Jul 11, 2009 at 9:33 PM, Kenneth Tilton<kentilton at gmail.com> wrote:
> Andy,
>
> Please search on :motionnotify. I see an example in the gears demo. I know
> that is OpenGL but I am pretty sure all the code you see in there in re
> event handling is generic to Tk, nothing about OpenGl.
>
> The nise thing about Tk via FFI is the control one gets from low-level
> access to the event stream. There are rare cases where I feel Tk did not
> expose enough via an API -- I remember vaguely something about key events,
> forcing me to code up a virtual event handler -- but as a rule the Tcl/Tk
> world is your oyster with an FFI based interface.

Cool I've got something working.  Just posting it to the list in-case
anyone else
wants to use it...

The usage would be...

(defmd my-window (window)
  :kids (c? (the-kids
	     (mk-stack (:packing (c?pack-self))
	       (mk-label :text "hi"
                 :on-hover (lambda ()
			     (trc "hovering...")))))))

The on-hover function only gets called after the mouse has been sitting in the
widget for 1 1/2 seconds.  The attached patch puts an on-hover slot on
the widget
class so you should be able to apply to any widget in your hierarchy.

--
Andy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hover.patch
Type: text/x-patch
Size: 2617 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cells-devel/attachments/20090711/55e8047b/attachment.bin>


More information about the cells-devel mailing list