Re: Passing info and destroying widgets... [message #15897 is a reply to message #15879] |
Mon, 21 June 1999 00:00  |
Robert King
Messages: 9 Registered: March 1999
|
Junior Member |
|
|
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
Widget_Control, event.top, SET_UVALUE=info,/NO_COPY
Widget_Control, event.top,/DESTROY
END
ENDCASE
Widget_Control, event.top, SET_UVALUE=info, /NO_COPY
END
I eventually created a separate event handler to destroy the widgets, eg
Pro kill_widgets, event
Widget_Control, event.top,/DESTROY
END
This worked with no errors!
I'd like to know if there is another way around this problem as it seems
rather strange behavoir.
Regards,
Robert
Dirk Fabian <dirk@uwast.astro.wisc.edu> wrote in article
<7kkn9k$sag$1@news.doit.wisc.edu>...
>
> Here's something i can't figure out... I'm following the advice of DF and
> communicating between my widgets with info structures. All is well, but
now i
> want to pass the info structure from the event handler back to the parent
widget
> with
>
> WIDGET_CONTROL, event.top, SET_UVALUE=lines, /NO_COPY
>
> and then destroy the widget. But you can't do this, because
WIDGET_CONTROL (i
> think) dereferences event.top so that
>
> WIDGET_CONTROL, event.top, /DESTROY
>
> fails since it doesn't know where to look. (you can't even put in a
dummy to hold
> the event.top number, the widget itself is gone from that id)
>
> Unfortunately, you can't /DESTROY the top widget first and expect to set
it's
> UVALUE later, either. So what do i do here? I tried putting a flag in
my
> info structure to trigger the base widget destruction back in the widget
> definition level (not in the event handler), but i can't figure out when
the
> program would be able to look at that newly inserted flag.
>
> Thanks for your help. - Dirk
>
>
>
|
|
|