[ wxwindows-Patches-1905695 ] wxOwnerDrawnComboBox clears index on ShowPopup()

SourceForge.net noreply at sourceforge.net
Sun Mar 2 06:29:38 PST 2008


Patches item #1905695, was opened at 2008-03-02 15:17
Message generated for change (Comment added) made by vadz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1905695&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: Generic
Group: bug fix
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Jaakko Salli (jmsalli)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxOwnerDrawnComboBox clears index on ShowPopup()

Initial Comment:

Currently wxOwnerDrawnComboBox may clear value index in ShowPopup(), via SetStringValue() call, resulting in value image not being drawn in control when popup is visible (ie. OnDrawItem() is not called when m_value == -1). This may be unwanted behaviour since text in contained wxTextCtrl may not match any list item (for instance, in a colour selector text may be an arbitrary colour RGB value, while list only has presets).

Patch is for 2.8 branch. I will submit a better one for trunk.

--- odcombo.cpp.orig	Sun Mar 02 16:04:29 2008
+++ odcombo.cpp	Sun Mar 02 16:00:18 2008
@@ -632,10 +632,11 @@
 {
     int index = m_strings.Index(value);
 
-    m_value = index;
-
-    if ( index >= -1 && index < (int)wxVListBox::GetItemCount() )
+    if ( index >= 0 && index < (int)wxVListBox::GetItemCount() )
+    {
+        m_value = index;
         wxVListBox::SetSelection(index);
+    }
 }
 
 void wxVListBoxComboPopup::CalcWidths()


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

>Comment By: Vadim Zeitlin (vadz)
Date: 2008-03-02 15:29

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

Applied, thanks!

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

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




More information about the wx-dev mailing list