Opened 5 years ago

Closed 5 years ago

#15647 closed defect (fixed)

wxComboBox problem if id is 1000

Reported by: Dimension3D Owned by:
Priority: low Milestone: 3.0.0
Component: GUI-generic Version: 3.0.0-rc2
Keywords: wxComboBox Cc:
Blocked By: Blocking:
Patch: no


If the window id of a wxComboBox is 1000, the drop-down list no longer reacts to mouse clicks. Selecting an item in the drop-down list with the mouse is not possible. Using keyboard still works. Other ids seem to be not affected.

This can be reproduced by setting the id in the combo box sample to 1000. I tested on Windows 7 64bit.

This problem is new in 3.0, it was not in 2.9.4.

Change History (4)

comment:1 Changed 5 years ago by vadz

  • Status changed from new to infoneeded_new

I don't see any problems with this patch:

  • samples/combo/combo.cpp

    diff --git a/samples/combo/combo.cpp b/samples/combo/combo.cpp
    index ecf4898..22c1288 100644
    a b class wxFileSelectorCombo : public wxComboCtrl 
    766766    // use two-step creation for it to work properly.
    767767    cc->SetTextCtrlStyle(wxTE_RIGHT);
    769     cc->Create(panel, wxID_ANY, wxEmptyString);
     769    cc->Create(panel, 1000, wxEmptyString);
    771771    // Make sure we use popup that allows focusing the listview.
    772772    cc->UseAltPopupWindow();

Could you please indicate what exactly needs to be done to reproduce the bug?

comment:2 Changed 5 years ago by Dimension3D

  • Status changed from infoneeded_new to new

cc is a wxComboCtrlWithCustomPopupAnim, not a wxComboBox.

The line I changed is 1048:

cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,

wxDefaultPosition, wxDefaultSize,



cb = new wxComboBox(dlg,1000,wxEmptyString,

wxDefaultPosition, wxDefaultSize,


I also tried the read only wxComboBox in line 1067. Same result.

Theses combo boxes are not in the main window, but in the dialog.

comment:3 Changed 5 years ago by vadz

  • Status changed from new to confirmed

I do see it, thanks. In fact it can be seen in the minimal sample with just the following change:

  • samples/minimal/minimal.cpp

    diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp
    index a78e462..8b459b1 100644
    a b bool MyApp::OnInit() 
    172172    CreateStatusBar(2);
    173173    SetStatusText("Welcome to wxWidgets!");
    174174#endif // wxUSE_STATUSBAR
     176    (new wxComboBox(this, 1000, "", wxPoint( 10, 10)))->Append("Foo");
     177    (new wxComboBox(this, 2000, "", wxPoint(150, 10)))->Append("Bar");

The left combobox doesn't work, the right one does. Debugging...

comment:4 Changed 5 years ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [75134]) Fix behaviour of wxComboBox using ID=1000 in wxMSW.

If a wxComboBox was created with ID=1000, clicking in its drop down didn't

It turns out that the native combobox control always creates its dropdown
listbox with the ID of 1000 and that when we were getting LBN_SELCHANGE from
it we mishandled this message because our code mistakenly believed that all
messages from the ID of the control itself were, in fact, coming from this
control, which wasn't the case here.

Fix this by adding a special check for this case in wxComboBox. Also
virtualize the dynamic cast which was done in wxWindow::FindItem() as this
makes the code simpler and allows to get rid of WXUNIVERSAL #ifdef as

Closes #15647.

Note: See TracTickets for help on using tickets.