horizontal scrollbars and/or "tooltips" on wxComboBox

Hi,

I recently converted a GUI from Tcl/TK to wxPython, and
just noticed that a significant piece of functionality was
lost in the transition: the wxComboBoxes don't have a
horizontal scrollbar for the showing the choices if any
of them are too big to fit in the fixed size of the control.

Is there a way I can either get this back or get
"tooltip-like" functionality displaying the entire
contents on mouseover of the choice? (Either would do...)
(I'm working with MSW, and I don't really care about
cross-platform compatibility for this application, if that
makes any difference.)

Thanks in advance,
/Will Sadkin
Parlance Corporation
www.nameconnector.com

Will Sadkin wrote:

the wxComboBoxes don't have a
horizontal scrollbar for the showing the choices if any
of them are too big to fit in the fixed size of the control.

My way to solve this is to use sizers to size the combo box so it's
always big enough to hold the choices.

I know that's not what you were looking for, but it may be worth
considering.

-CHB

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Will Sadkin wrote:

Hi,

I recently converted a GUI from Tcl/TK to wxPython, and
just noticed that a significant piece of functionality was
lost in the transition: the wxComboBoxes don't have a horizontal scrollbar for the showing the choices if any of them are too big to fit in the fixed size of the control.

Is there a way I can either get this back or get "tooltip-like" functionality displaying the entire
contents on mouseover of the choice? (Either would do...)
(I'm working with MSW, and I don't really care about
cross-platform compatibility for this application, if that
makes any difference.)

You could get the window handle of the combobox and use the win32api module to send CB_SETHORIZONTALEXTENT to the native control to set the width of the largest item. It should then automatically use the horizontal scrollbar if needed. Something like this (untested):

  import win32api, win32con
  win32api.SendMessage(combo.GetHandle(),
                              win32con.CB_SETHORIZONTALEXTENT,
           maxwidth, 0)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!