Re: problem getting values from cw_bgroup normal base [message #26211] |
Thu, 09 August 2001 11:21 |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Lisa Gandy wrote:
>
> I have set up a cw_bgroup in a normal base and am trying to get the
> individual values for each button. This is the code that
> I am using to set up the compound widget
>
> main_bgroup_arr = ['one','two','three']
> main_bgroup = cw_bgroup(base,main_bgroup_arr,/return_index,/column,$
> label_top='Main Menu',/frame,uvalue = 1)
>
> and this is the code that I am using to try to access the individual
> values for the buttons...
>
> widget_control,main_bgroup,get_value=val.
>
> The xmanager catches the error and says
> "unable to get plain button group value".
>
> How do I get the individual values for each button? Can I not
> use the widget_control, get_value property??
Right, you can not use get_value for normal buttons in CW_BGroup.
If you want to know which button was pushed, you could use the VALUE
field in the event structure. You specified that it should be returned
as the button's INDEX value when you set RETURN_INDEX = 1.
from the online help...
> Button Group widgets generates event structures with the following definition:
> event = {ID:0L, TOP:0L, HANDLER:0L, SELECT:0, VALUE:0 }
> The SELECT field is passed through from the button event. VALUE is either the INDEX, ID, NAME, or BUTTON_UVALUE of the button, depending on how the widget was created.
Ben
--
Ben Tupper
Bigelow Laboratory for Ocean Sciences
180 McKown Point Rd.
W. Boothbay Harbor, ME 04575
btupper@bigelow.org
|
|
|
Re: problem getting values from cw_bgroup normal base [message #26212 is a reply to message #26211] |
Thu, 09 August 2001 10:19  |
david[2]
Messages: 100 Registered: June 2001
|
Senior Member |
|
|
Lisa Gandy writes:
> I have set up a cw_bgroup in a normal base and am trying to get the
> individual values for each button. This is the code that
> I am using to set up the compound widget
>
> main_bgroup_arr = ['one','two','three']
> main_bgroup = cw_bgroup(base,main_bgroup_arr,/return_index,/column,$
> label_top='Main Menu',/frame,uvalue = 1)
>
>
> and this is the code that I am using to try to access the individual
> values for the buttons...
>
> widget_control,main_bgroup,get_value=val.
>
> The xmanager catches the error and says
> "unable to get plain button group value".
>
> How do I get the individual values for each button? Can I not
> use the widget_control, get_value property??
No, you can't use the GET_VALUE keyword to get
the button IDs. You can get the button IDs when
you create the button group by using the IDS output
keyword. Then, if you want to use the button IDs
later, you will have to store the values in the info
structure along with everything else you need to
run the program.
main_bgroup_arr = ['one','two','three']
main_bgroup = cw_bgroup(base,main_bgroup_arr,/return_index,/column,$
IDS=buttonIDs, label_top='Main Menu',/frame,uvalue = 1)
...
info = { buttonIDs:buttonIDs, ... }
Widget_Control, tlb, Set_UValue=info, /No_Copy
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
|
|
|