Re: how get value from combobox [message #60694] |
Tue, 10 June 2008 08:56 |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
skymaxwell@gmail.com wrote:
> how get value, which user selected, from combobox widget ???
> Thanks
from the help file:
Widget Events Returned by Combobox Widgets
Pressing the mouse button while the mouse pointer is over an element of
a combobox widget causes the widget to change the text field on the
combobox and to generate an event. The event structure returned by the
WIDGET_EVENT function is defined by the following statement:
{WIDGET_COMBOBOX, ID:0L, TOP:0L, HANDLER:0L, INDEX:0L, STR:""}
The first three fields are the standard fields found in every widget
event. INDEX returns the index of the selected item. This can be used to
index the array of names originally used to set the widget's value. If
the event was caused by text changes in an editable combobox, the INDEX
field will be set to -1. If you are using an editable combobox, it is
important to check for the value of -1 prior to using the value of the
INDEX field as an index into the array if items. The text of the current
selection is returned in the STR field, which may eliminate the need to
use the index field in many cases.
so, in your event handler, do something like:
IF (TAG_NAMES(event, /STRUCTURE_NAME) eq 'WIDGET_COMBOBOX') THEN
selectedText = event.str
Jean
|
|
|