Re: XForms: gl_canvas with canvashandlers, and other FL_OBJECTs

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 10 Nov 98 07:51:35 PST

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I have a slider (return when changed) on the same form. When I press
> mouse1 on the slider to move it, it behaves as expected, but when I
> enter the region of the form taken up by the gl_canvas with the
> mouse pressed both objects simultaniously interpret the
> motion-events. I tried fiddling around with enter- and
> leave-notification events, and registering/deregistering the motion
> callback on button press, but didn't get anywhere really.

> Have I missed something in the manual?

Probably not.

You're on the right track.

I faced the same problem and simply set a flag indicating mouse button
down in a data structure accessable by the motion event handler. If
the flag isn't set, I just toss the event and return.

Another way is, as you suggested, to register and deregister the
motion event handler on the fly and this should work. There is one
small gotcha in registering motion event handlers. You must set the
OwnerGrabButtonMask for the motion event handler to be registered
properly (I'm not sure I understand the rationale for this -- there
are some design decisions made by the X designers that make my head
hurt). Call

fl_addto_selected_xevent( FL_ObjWin( your_canvas ),
OwnerGrabButtonMask );

You'll then be able to add and remove your motion handler from your
ButtonPress and ButtonRelease handlers at will.

spl
_________________________________________________
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://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/