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

Home » Public Forums » archive » 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
combobox widget text [message #63577] Fri, 14 November 2008 14:17 Go to next message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
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

cheers,
Greg
.
Re: combobox widget text [message #63643 is a reply to message #63577] Sun, 16 November 2008 14:38 Go to previous message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
That's a smart solution - thanks very much, David! A keyword would
have been nice, but this must be the IDL way...

cheers,
Greg
Re: combobox widget text [message #63664 is a reply to message #63577] Sat, 15 November 2008 08:31 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Widget_Control, event.id, 4
> SET_COMBOBOX_SELECT=N_Elements(newList)-1

Whoops! That "4" should be a dollar sign ($).

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 #63665 is a reply to message #63577] Sat, 15 November 2008 08:30 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
greg michael writes:

> 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?

Oh, alright. How about this:

PRO ComboWidgetTest_Event, event
Widget_Control, event.id, GET_UVALUE=defaultList
IF event.index EQ -1 THEN BEGIN
I = Where(StrUpCase(defaultList) EQ StrUpCase(event.str), count)
IF count EQ 0 THEN BEGIN
newList = [defaultList, event.str]
Widget_Control, event.id, SET_VALUE=newList
Widget_Control, event.id, 4
SET_COMBOBOX_SELECT=N_Elements(newList)-1
ENDIF
ENDIF ELSE BEGIN
IF event.index EQ N_Elements(defaultList) THEN RETURN
Widget_Control, event.id, SET_VALUE=defaultList
Widget_Control, event.id, SET_COMBOBOX_SELECT=event.index
ENDELSE
END
;----------------------------------------------------------- ------------

PRO ComboWidgetTest, newValue
IF N_Elements(newValue) EQ 0 THEN newValue = 'pig'
tlb = Widget_Base(/COLUMN, XOFFSET=150, YOFFSET=150)
defaultValues = ['dog', 'cow', 'coyote']
combo = Widget_Combobox(tlb, VALUE=[defaultValues, newValue], $
/EDIT, SCR_XSIZE=100, UVALUE=defaultValues)
Widget_Control, tlb, /REALIZE
Widget_Control, combo, Set_Combobox_Select = 3
XManager, 'combowidgettest', tlb, /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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Calculate the mean of many images
Next Topic: program variables

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

Current Time: Wed Oct 08 15:39:25 PDT 2025

Total time taken to generate the page: 0.00576 seconds