combobox doesn't work... [message #46760] |
Tue, 20 December 2005 10:05 |
Mike[2]
Messages: 99 Registered: December 2005
|
Member |
|
|
Dear IDL gang,
A while ago I came across the following note in the IDL docs that said
WIDGET_COMBOBOXs were recommended as a replacement for
WIDGET_DROPLISTs:
"Note
The WIDGET_COMBOBOX function creates a similar widget that allows
users to edit the text displayed by the droplist. The combobox
intended to replace the droplist widget; RSI recommends that new code
WIDGET_COMBOBOX rather than WIDGET_DROPLIST."
(p 2230, IDL Reference Guide (6.0))
So I wrote some code that uses comboboxes instead of droplists only to
find that they really don't work, at least not on all platforms.
Blech.
Here's the problem: Suppose I create a combobox with a single item as
in the appended code. As I add items to a widget_combobox, the
display of the the list of options is not expanded to include the
added items. The user must navigate the list using arrow buttons that
themselves do not fit into the list pane. How can I resize the
combobox list to make it usable?
This problem occures with IDL 6.0 and 6.1 on intel/linux, but not on
wintel IDL 6.1.
So I checked the archives and found comp.lang.idl-pvwave postings that
reference this problem from more than a year ago, but no solutions.
I've submmitted a support request to RSI, but I thought I'd also post
it here to see if anyone has come up with anything in the mean time.
For now it looks like "use droplists instead of comboboxes" is the
best solution, but I'm relatively lazy and would prefer a little-or-
no-effort-need-be-expended-on-my-part solution so I don't have to
modifiy a lot of code.
; This program is based on widget1.pro, used as an example in the
"Creating
; Widget Applications" chapter of the _Building IDL Applications_
manual.
PRO widget_mm_event, event
case event.id of
widget_info(event.top, find_by_uname='add'): begin
combobox = widget_info(event.top, find_by_uname='combobox')
widget_control, combobox, get_value=value
widget_control, combobox, combobox_additem='item
'+strtrim(n_elements(value),2)
end
widget_info(event.top, find_by_uname='done'): begin
WIDGET_CONTROL, event.TOP, /DESTROY
end
else: ; do nothing
endcase
END
PRO widget_mm
base = WIDGET_BASE(/COLUMN)
button = WIDGET_BUTTON(base, value='add entry', uname='add')
combobox = widget_combobox(base, uname='combobox', value=['- None
-'], /dynamic_resize)
button = WIDGET_BUTTON(base, value='Done', uname='done')
WIDGET_CONTROL, base, /REALIZE
XMANAGER, 'widget_mm', base
END
|
|
|