selection box in widget program [message #55992] |
Wed, 26 September 2007 09:45  |
markb77
Messages: 217 Registered: July 2006
|
Senior Member |
|
|
Hi,
I'm writing a program that needs to ask the user to select a region of
an image. I'd like to have a routine that would allow the user to
click and drag a selection box (a rubber band box), returning the
coordinates of the box to the program once the user has made a
selection.
This is a widget program using object graphics.
The draw window displaying the widget has its own event handler,
handling keyboard, motion, and button click events.
What I want to do, essentially, is temporarily have all of the motion
and button click events handled by the drawbox routine. This way I
can loop on a call to widget_event, obtaining all of the mouse events,
and continually redrawing the selection box, until the user is done.
So, what I am going to try to do is UNSET the EVENT_PRO keyword to the
draw widget, loop on widget_event as described, and then re-set the
EVENT_PRO keyword to the original event handler.
Is this how people usually go about handling these situations? It
seems like clicking and dragging a selection box would be the world's
most common routine, but I haven't found many examples of it when
using object graphics and widget programs with event handlers.. etc.
To summarize, what I'm trying to build is a black box routine that
waits for the user to click and drag a selection box, returning the
coordinates, all within an object graphics, widget program.
thanks,
Mark Bates
Harvard University
|
|
|
|