comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: combobox widget text
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: combobox widget text [message #63574] Fri, 14 November 2008 14:50 Go to next message
David Fanning is currently offline  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.")
Re: combobox widget text [message #63666 is a reply to message #63574] Sat, 15 November 2008 07:50 Go to previous message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
Thanks, David, for that very nice example. Maybe it's a strange thing
to wish for, but I was hoping to put a value into the edit box without
changing the drop-down list. My application is this: I want to display
an image at a selected resolution - normally a multiple of the true
resolution (12.5 m/pix, 25, 50, 100...) - but to allow the possibility
to enter any value in between. Hence the combobox. I also want to be
able to save and recover the view, so I need to put a value back into
wherever ev.str comes from. I'd expect to find it as a
widget_control,set_something= but I don't see it. Any ideas?

cheers,
Greg
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ncdf string array dimension
Next Topic: how to draw contour with continue color?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:26:45 PDT 2025

Total time taken to generate the page: 0.00463 seconds