Re: XForms: which form the mouse is in?

T.C. Zhao (zhao@bloch.phys.uwm.edu)
Tue, 13 Jan 1998 22:48:56 -0600

To subscribers of the xforms list from zhao@bloch.phys.uwm.edu (T.C. Zhao) :

from msz@bulge.astrouw.edu.pl (Michal Szymanski) :

>I have a multi-form application and need to know programatically which
>form the mouse pointer is in at a given moment.
>1. fl_get_form_mouse() returns window ID of the form which is given as the
>first argument, EVEN IF the mouse is not in that form ;-((
This is not the right routine to use. get_form_mouse simply
gets the mouse position relative to the specified form regardless
if the mouse is in the form or not although it is intended
to be used when the mouse is indeed in the form.

>2. fl_get_mouse() returns window ID which reflects the true position of
>the mouse, BUT it is NOT the ID which is stored in FL_FORM structure
>"window" parameter (and which is used/returned by fl_get_form_mouse()).
> "fl_win_to_form()"
>invoked on the ID returned by "fl_get_mouse()" always gives NULL.
fl_get_mouse followed by fl_win_to_form is the (supposedly)
right way to get the form that mouse is in.
I am kind of suprised that this does not work. I must admit that
I haven't tested this as it's so simple that I just thought it should work.
I will try it tomorrow.

>future releases, I would vote
>for a FL_FORMS' equivalent of FL_OBJECT's "belowmouse" flag.
But this calls for a search of all visible forms by
the application program if you want to get the handle
to the form. I still think fl_win_to_form(fl_get_mouse())
(if it works of course) is easier. Alternatively, you can
use a posthandler on a large box covering the entire form
to get signaled when the mouse enters the form.

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bloch.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/