Re: XForms: drag & drop within a form (canvas?)

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 9 Feb 99 19:42:29 PST

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

> Is this a simple matter of having a callback routine detect when the mouse
> button goes down & then drag the selected menu item until the button is
> released?

First off, I probably wouldn't use a Canvas object since you're more
or less on your own regarding drawing there.

I seem to recall discussing this on the list some time ago but I
scanned the archives and didn't find anything there.

Basically if you want to drag an object around you have to be a bit
clever -- you can't just install a pre- or posthandler and watch the
FL_MOUSE events since after the first move XForms doesn't send any
more events to the handler. (TC: Bug or feature?)

You have at least two alternatives -- either install a raw callback
(refer to Appendix D, Dirty Tricks) when you receive the FL_PUSH event
and use it to track the cursor position, issuing
fl_set_object_position() calls as you go. The alternative is to drag
a rectangle around with the fl_drw_box(). Of course there you have to
undraw the old box as you move it, meaning you either want to use XOR
drawing or force the form to be completely redrawn for every move.

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/