[wxMSW,wxGTK] wxChoice, height of dropdown list

Carsten A. Arnholm arnholm at offline.no
Sat Dec 22 15:13:43 PST 2007


Carsten A. Arnholm wrote:
> Vadim Zeitlin wrote:
>>
>> Sorry, I also forgot about another, maybe simpler, solution:
>> wxComboBox is a native control but wxComboCtrl is a
>> combobox implemented entirely in wx. And it should be
>> definitely easier to extend it to support the feature
>> you need than reimplementing it.
>
> Thank you, Vadim.
>
> Aha..this does indeed look quite promising, I shall explore this
> option then. It looks similar to my first idea, but it is obviously
> more proper/general.

Hi again,

Today I have looked at this option and can report some progress. An 
experimental "wxChoiceWx" class is made, it is intended to function as a 
substitute for wxChoice. I.e. it is compatible enough to be used as a 
wxChoice-replacement in Code::Blocks/wxSmith RAD tool. It allows control 
over the length of the dropdown menu (number of items shown).

wxChoiceWx inherits from wxComboCtrl and uses the "wxListViewComboPopup" 
minimal sample code shown at 
<http://www.wxwidgets.org/manuals/2.8/wx_wxcomboctrl.html#wxcomboctrl>
(Note the sample has a bug, EVT_LEFT_UP should be EVT_LEFT_DOWN).
I have also extended wxListViewComboPopup slightly as needed for this.

A sample app is made in Code::Blocks to illustrate some differences in 
behaviour between wxChoice, wxComboBox and wxChoiceWx on wxGTK and wxMSW. 
All are given 88 string alternatives (the names of the celestial 
constellations) to select from

Some screenshots
<http://www.arnholm.org/tmp/wxChoice/index.html>

Observations for wxGTK:
- wxChoice has a nice 3d look and feel, wxComboBox is flat, the same is true 
for wxChoiceWx
- The popup for wxChoice looks crazy, it fills the whole screen height
- The popup for wxComboBox extends to top or bottom of screen. Almost as bad 
as wxChoice.
- The popup for wxChoiceWx defaults to 10 items and provides a scrollbar for 
navigation. The length can be controlled by an application.

Observations for wxMSW
- The popup for wxChoice with 88 alternatives is too long
- The popup for wxComboBox with 88 alternatives is too long, looks the same 
as wxChoice
- The popup for wxChoiceWx defaults to 10 items and provides a scrollbar for 
navigation. The length can be controlled by an application. Selection seems 
to be highlighted with an odd background colour, not quite like wxChoice & 
wxComboBox.

If there is interest, I would be happy to contribute this (maybe after some 
more work/testing and possibly name change?).

Regards
Carsten A. Arnholm
http://arnholm.org/
N59.776 E10.457








More information about the wx-users mailing list