Lisp HUG Maillist Archive

How to catch "mouse leave" event ?

Hi

I need to make custom control, which will have light background when mouse over and will return to dark when mouse leave. I couldn't find any good method to catch mouse leaving event. CAPI has tracking-pinboard-layout, but I don't find how to customize highlighting for it's sub-objects. It somehow implemented for toolbar buttons. It would be convenient to have "mouse leave" callback for output-pane to implement different controls.

There is HELP-CALLBACK for interfaces, is it best way to notify pane that mouse is leaving it's area ?

Best regards
Lisper


Re: How to catch "mouse leave" event ?

lisptracker@mail.ru writes:

> Hi
>
> I need to make custom control, which will have light background when mouse over and will return to dark when mouse leave. I couldn't find any good method to catch mouse leaving event. CAPI has tracking-pinboard-layout, but I don't find how to customize highlighting for it's sub-objects. It somehow implemented for toolbar buttons. It would be convenient to have "mouse leave" callback for output-pane to implement different controls.

Maybe not the ideal solution, but by adding

        :input-model '(((:motion my-motion-callback)))

in the pinboard-layout, my-motion-callback can then turn on and off
whatever you want.
-- 
  (espen)


Re: How to catch "mouse leave" event ?

Two things come to mind:

1) As Espen suggested, put the button in a pinboard-layout, register
for mouse motion, and see if you can't combine WITH-GEOMETRY and the
x, y coordinates passed to the event handler to get the behavior you
want.

2) If you're feeling bold, and the above solution doesn't work, you
can always get at the underlying representation of a CAPI widget and
try to play around with that.  For example, on the Win32 personal
ediition (I assume you're using Windows from your mention of
WM_MOUSELEAVE):

CL-USER 4 > (capi-internals:representation (capi:contain
(make-instance 'capi:push-button)))
#<Representation CAPI-WIN32-LIB::R-PUSHBUTTON #<CAPI:PUSH-BUTTON "NIL"
200EF747>>

and you can use the Inspector to see if that's useful to you.  Perhaps
it isn't, though, as I'm not sure how you'd hook a message handler
into a button on Windows if there's already an event handler
defined...

On 2/16/07, Lisper <lisptracker@mail.ru> wrote:
>
> I am afraid you are right. ;-( There is starting long term project where
> Lisp would be perfect choice, but one of the key requirements is specific
> GUI with flat buttons, etc. I can implement much of missing GUI elements,
> but need more control. I see in QT library that same functionality is
> implemented using WM_MOUSELEAVE notifications.
>
> ----- Original Message -----
> From: "Bill Atkins" <atkinw@rpi.edu>
> To: "Lisper" <lisptracker@mail.ru>
> Sent: Friday, February 16, 2007 11:13 PM
> Subject: Re: How to catch "mouse leave" event ?
>
>
> > On 2/16/07, Lisper <lisptracker@mail.ru> wrote:
> >> It is doesn't solve whole problem. It captures mouse motion only within
> >> the
> >> pane, but it don't catch a moment when mouse leave the pane. Toolbar
> >> buttons
> >> somehow know when mouse leaves toolbar area. How do they know that ?
> >
> > Presumably because toolbars are implemented as native widgets, and
> > native toolbar buttons know how to do that.
> >
> > --
> > Bill Atkins
> >
>
>


-- 
Bill Atkins


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