Re: Help with widgets code [message #649 is a reply to message #648] |
Tue, 08 December 1992 13:29  |
mberkley
Messages: 5 Registered: December 1992
|
Junior Member |
|
|
> On Mon, 7 Dec 1992 19:49:25 GMT, scowen@wfpc3.la.asu.edu (Paul A. Scowen) said:
PAS> Now, what I'm faced with is a lack of communication between the
PAS> two proc's. For instance, if I have displayed my fabulous image
PAS> into the draw widget, and then hand off control to the xmanager,
PAS> but then decide that I want a button (already defined) to
PAS> initiate a redraw of the image but using the log of the data, how
PAS> do I tell the event proc what the original image array was?
PAS> There appears to be no way to pass this information across the
PAS> xmanager call?
You need to use the UVALUE of one of the widgets; the top level widget
works best.
Before XMANAGER call:
WIDGET_CONTROL,SET_UVALUE=mydata,topwidget
In event handler:
WIDGET_CONTROL,GET_UVALUE=mydata,event.top
mydata can be an anonymous structure, an array, anything you want.
A few hints:
1. Don't use common blocks in widgets ever: you pay for them later
if you want to support multiple instances of any particular
widget. IDL sample widgets (e.g. animate,slicer) suffer from this
problem.
2. Remember that the uvalue is a copy of the original data, not a
pointer to it. This is usually not a problem, but I had some
problems with passing huge structs around because I could only
pass a copy and not a pointer.
Mike Berkley
mberkley@sirius.UVic.CA
|
|
|