[ wxwindows-Bugs-1599501 ] wxComboBox goes off the screen.

SourceForge.net noreply at sourceforge.net
Tue Feb 26 07:29:21 PST 2008


Bugs item #1599501, was opened at 2006-11-20 06:49
Message generated for change (Settings changed) made by juliansmart
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1599501&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: WinCE specific
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: FourPins (fourpins)
>Assigned to: Nobody/Anonymous (nobody)
Summary: wxComboBox goes off the screen.

Initial Comment:
Using wxWidgets 2.6.3 for WinCE under a PocketPC emulator and an actual SmartPhone.

My application uses wxComboBox objects from top to bottom.  When any one of them gets roughly twenty items or more in it the drop down becomes so large that it extends off the screen and a few choices become unreachable.  By adding more items scroll bars show up, however the size is still too tall to pick all the options (either the very bottom or top based on if the  drop down menu goes up or down).

A simple fix would be to set the drop down's maximum height to a little less (specifically half a wxComboBox's height) than half the screen height.  However, you may not want to sacrifice that many on screen options (then something more dynamic would have to be created).

I'd be happy to solve my own problem (and have tried).  However, I cannot find the file where this behavior is set.  If you point me in this direction please also point me to guidelines on how to best submit my code.

----------------------------------------------------------------------

Comment By: FourPins (fourpins)
Date: 2006-11-28 06:41

Message:
Logged In: YES 
user_id=1649544
Originator: YES

In src/msw/choice.cpp in the function wxChoice::DoSetSize immediately
above the call to wxControl::DoSetSize I wrote the following code.

#if defined(__WXWINCE__)
	int ItemHeight = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0);
	int HalfScreenHeight = (wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) / 2)
- ItemHeight;
	
	if(height > HalfScreenHeight)
		height = HalfScreenHeight;
#endif

It works exactly as I expected.  It sets a maximum height of a little less
than half the screen height ensuring that no choice box extends off the top
or bottom on the screen.  This method does reduce the number of on screen
options dramatically.  While I'm happy with this solution (actually I
prefer the consistent maximum height), I can understand if the community
wanted a solution that took into account the choice box's position on the
screen.  Please share your thoughts and I will try to accommodate.

Thanks Vadim for pointing me in the right direction.  I'll take a look at
http://www.wxwidgets.org/technote/patches.htm as soon as I get a chance.

----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2006-11-24 01:21

Message:
Logged In: YES 
user_id=71618
Originator: NO

The file is src/msw/combobox.cpp and maybe src/msw/choice.cpp, especially
various methods with "Size" in their names.

For submitting the code, please read
http://www.wxwidgets.org/technote/patches.htm, TIA!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1599501&group_id=9863




More information about the wx-dev mailing list