Re: combobox widget text [message #63574] |
Fri, 14 November 2008 14:50  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
greg.addr@googlemail.com writes:
> Does anyone know how to set the value of an editable combobox such
> that it's *not* one of the current list items? I have the drop-down
> filled with standard values, but want to be able to save and recover a
> user entered value
Here is a little example that allows the users to type new
animal names into the combobox. If the name is not currently
on the combobox list, it is added.
;*********************************************************** ****
PRO test_event, ev
IF ev.index EQ -1 THEN BEGIN
Widget_Control, ev.id, Get_Value=currentVal
I = Where(StrUpCase(currentVal) EQ StrUpCase(ev.str), count)
IF count EQ 0 THEN $
Widget_Control, ev.id, Set_Value=[currentVal, ev.str]
ENDIF
end
PRO test
b = Widget_base(/column, xoffset=50, yoffset=50)
t = widget_combobox(b, value=['dog', 'cow', 'coyote'], $
/EDIT, SCR_XSIZE=100)
widget_control, b, /realize
xmanager, 'test', b, /no_block
END
;*********************************************************** ****
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|