Re: Passing info and destroying widgets... [message #15894 is a reply to message #15879] |
Mon, 21 June 1999 00:00   |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Robert King wrote:
>
> Hi Dirk,
>
> I think that I came across this exact same problem only yesterday! I was
> using one event handler to manage all my events including exit/quit events
> where the widget hierarchy is destroyed, i.e. something like
>
> ;----------------------------------------------
>
> Pro my_event_handler, event
> Widget_Control, event.top, GET_UVALUE=info, /NO_COPY
> Widget_Control, event.id , GET_UVALUE=button
>
> CASE button OF
> 'Open' :BEGIN
> ....
> END
> 'Save' :BEGIN
> ....
> END
> 'Quit' :BEGIN
> SET_UVALUE=info,/NO_COPY
> Widget_Control, event.top,/DESTROY
> END
> ENDCASE
> Widget_Control, event.top, SET_UVALUE=info, /NO_COPY
> END
>
> [...]
seems to me as if the problem with your routine lies in the statement
AFTER the case construct: there you make another reference to event.top
which no longer exists. What you could do is:
WIDGET_ACTIVE=1
CASE button OF
...
'Quit' :BEGIN
Widget_Control, event.top, /DESTROY
WIDGET_ACTIVE=0
END
ENDCASE
IF (WIDGET_ACTIVE) THEN $
Widget_Control, event.top, SET_UVALUE=info, /NO_COPY
It just doesn't make sense to set a UVALUE in a widget that no longer
exists.
Regards,
Martin
--
|||||||||||||||\\\\\\\\\\\\\-------------------///////////// //|||||||||||||||
Martin Schultz, DEAS, Harvard University, 29 Oxford St., Pierce 109,
Cambridge, MA 02138 phone (617) 496 8318 fax (617) 495 4551
e-mail mgs@io.harvard.edu web http://www-as/people/staff/mgs/
|
|
|