Re: Widget Buttons - Radio and Checkbox control [message #19332] |
Wed, 08 March 2000 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Robert S. Mallozzi (robert.mallozzi@msfc.nasa.gov) writes:
> Unfortunately I don't think there is any way to query
> the state of exclusive or non-exclusive buttons:
>
> WIDGET_CONTROL, buttonID, GET_BUTTON = state
> % Keyword GET_BUTTON not allowed in call to: WIDGET_CONTROL
> % Execution halted at: $MAIN$
>
> You will have to store the current state and drag it
> around in your program :-(
Ah, another perfect opportunity to write an object
compound widget. This is *exactly* why I wrote
FSC_DROPLIST. I was tired of not being able to get
the "value" of the droplist directly from the
droplist itself. Plus, I wanted to be able to
set the "selection" by the name or value of the
selection, rather than always having to translate
things through the "index" of the darn thing.
I think of object compound widgets as widgets the
way they *should* have been written. :-)
You can find FSC_DROPLIST here, if you want a model:
http://www.dfanning.com/programs/fsc_droplist.pro
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Widget Buttons - Radio and Checkbox control [message #19333 is a reply to message #19332] |
Wed, 08 March 2000 00:00  |
robert.mallozzi
Messages: 11 Registered: November 1999
|
Junior Member |
|
|
In article <MPG.13301560857f17af989a7f@news.frii.com>,
davidf@dfanning.com (David Fanning) writes:
> Oliver Smith (osmith@dera.gov.uk) writes:
>
>> I'm currently writing some code in IDL 5.3 that utilises two groups of
>> widget buttons, 2 Check boxes and 4 Radio Buttons. I would like to be able
>> to set both check boxes and one of the radio buttons to be 'on' when the
>> program starts, and possibly to reset them at a later stage of program
>> execution after user intervention.
>>
>> Can anybody help me with this? I can't find any relevant information in the
>> IDL help.
>
> Widget_Control, buttonID, Set_Button=1
Unfortunately I don't think there is any way to query
the state of exclusive or non-exclusive buttons:
WIDGET_CONTROL, buttonID, GET_BUTTON = state
% Keyword GET_BUTTON not allowed in call to: WIDGET_CONTROL
% Execution halted at: $MAIN$
You will have to store the current state and drag it
around in your program :-(
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
Robert S. Mallozzi 256-544-0887
Mail Code SD 50
http://gammaray.msfc.nasa.gov/ Marshall Space Flight Center
http://cspar.uah.edu/~mallozzir/ Huntsville, AL 35812
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
|
|
|
Re: Widget Buttons - Radio and Checkbox control [message #19349 is a reply to message #19332] |
Wed, 08 March 2000 00:00  |
Ben Tupper
Messages: 186 Registered: August 1999
|
Senior Member |
|
|
Oliver Smith wrote:
> I'm currently writing some code in IDL 5.3 that utilises two groups of
> widget buttons, 2 Check boxes and 4 Radio Buttons. I would like to be able
> to set both check boxes and one of the radio buttons to be 'on' when the
> program starts, and possibly to reset them at a later stage of program
> execution after user intervention.
>
>
Hello,
Assuming that you are using CW_BGroup ... and that things haven't changed much
since version 5.2 ...
To control the radio buttons (exclusive) set the Set_Value keyword to
Widget_Control to the button index (starting from zero). As an example, to
have the second button of 4 buttons set on use Set_Value = 1
To control the check boxes (non-exclusive) set the Set_Value keyword to
Widget_Control to an array of on/off flags. As an example, to turn on the
second of the 2 button group but leave the first one off use Set_Value = [0,1]
You can also set the values when you first define the button groups with the
same keyword in CW_Group.
Hope this helps.
Ben
--
Ben Tupper
Bigelow Laboratory for Ocean Science
tupper@seadas.bigelow.org
pemaquidriver@tidewater.net
|
|
|
Re: Widget Buttons - Radio and Checkbox control [message #19350 is a reply to message #19332] |
Wed, 08 March 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Oliver Smith (osmith@dera.gov.uk) writes:
> I'm currently writing some code in IDL 5.3 that utilises two groups of
> widget buttons, 2 Check boxes and 4 Radio Buttons. I would like to be able
> to set both check boxes and one of the radio buttons to be 'on' when the
> program starts, and possibly to reset them at a later stage of program
> execution after user intervention.
>
> Can anybody help me with this? I can't find any relevant information in the
> IDL help.
Widget_Control, buttonID, Set_Button=1
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|