Re: Help with widgets code [message #648] |
Wed, 09 December 1992 00:35  |
hm342st
Messages: 2 Registered: September 1992
|
Junior Member |
|
|
> 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.
This is not completely true concerning the common blocks. The first time
using the widget set I was misleaded by the examples and used UVALUE just
as an identifier. No idea assigning 'real' data to it.
I found a solution using common blocks. They are not as bad as it seems.
It really depends on the data connected to them! I used list structures
which are fairly easily to handle. Using e.g. the base_widget as a key
in the list, it was possible to do all the things I, of course, better
should have done using a more comlex UVALUE (multiple instances).
Nowadays I am using UVALUEs, but I could not get rid of the lists, either.
I think, Vers. 3.0 with its possiblity to find out some relations between
widgtes will remove further lists.
- J"org
Reply-To: joerg.plewe@mpi-dortmund.mpg.de
|
|
|