comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Passing info and destroying widgets...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Passing info and destroying widgets... [message #15884 is a reply to message #15879] Mon, 21 June 1999 00:00 Go to previous messageGo to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
"Robert S. Mallozzi" wrote:
> I believe you must use XMANAGER in blocking mode for
> this technique to work.

Here's an example which works in non-blocking mode:

;---cut here---
PRO TEST_EVENT, EVENT

;- Get pointer from top level base, then the info structure

widget_control, event.top, get_uvalue=ptr
info = *ptr

;- Handle the widget which caused this event

widget_control, event.id, get_uvalue=name
case 1 of
name eq 'Button 1' or name eq 'Button 2' : info.name = name
else : widget_control, event.top, /destroy
endcase

;- Update the info structure

*ptr = info

END

;----------------------------------------------------------- -----

FUNCTION TEST, PTR

;- Create widgets

tlb = widget_base(/column)
but1 = widget_button(tlb, value='Button 1', uvalue='Button 1')
but2 = widget_button(tlb, value='Button 2', uvalue='Button 2')
but3 = widget_button(tlb, value='Done', uvalue='Done')
widget_control, tlb, /realize

;- Create info structure, and store pointer in top level base

info = {name:''}
ptr = ptr_new(info)
widget_control, tlb, set_uvalue=ptr

;- Manage events

xmanager, 'test', tlb, /no_block

;- Return pointer to caller

return, ptr

END
;---cut here---

Multiple instances can be invoked, e.g.

ptr1 = test()
ptr2 = test()
ptr3 = test()

Then to find the the last selected button of any of the instances of the
dialog,

info = *ptr1
print, info.name

--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: object suggestion for future IDL versions
Next Topic: Re: reading and plotting CDF from within IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 09:02:22 PDT 2025

Total time taken to generate the page: 1.00796 seconds