Re: picking an option with radio buttons [message #82156] |
Wed, 21 November 2012 13:12 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
jwwright86@gmail.com writes:
> apologies if this is a silly question. I have a base widget with a number of radio buttons in a child widget, and a continue and exit button on the base widget. I want to select an option with the radio buttons, and then have the continue button display different new base widgets, like cascading windows, depending on what radio button is selected. I have found this on idl-coyote
> http://www.idlcoyote.com/widget_tips/button_selected.html
> but I don't know what an info structure is, and how to initialise a currentButton field in this info structure. Any advice would be appreciated
An info structure (some people call it a state structure)
is simply a place where people store all of the information
they are going to need to run their widget program. It is
a way of passing needed information around to the different
program modules in a widget program that need to know
the information. It is usually stored in the user value of
the top-level base widget, because this is easily accessible
in every event handler module.
info = { ...., currentButtonID:currentButtonID, ... }
Widget_Control, tlb, Set_UValue=info
In an event handler you fetch the info structure with the
information you need:
PRO MyEventHandler, event
Widget_Control, event.top, Get_UValue=info
Widget_Control, info.currentButtonID, ...
These days info structures are usually stored in a pointer
variable, so you don't have to worry about copying it in
every event handler, so:
info = Ptr_New({ ...., currentButtonID:currentButtonID, ... })
Widget_Control, tlb, Set_UValue=info
In an event handler you fetch the info structure with the
information you need:
PRO MyEventHandler, event
Widget_Control, event.top, Get_UValue=info
Widget_Control, (*info).currentButtonID, ...
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|