Opened 5 years ago

Closed 5 years ago

#15231 closed defect (fixed)

Popup of wxOwnerDrawnComboBox not correctly positioned if the control is child of a toolbar (wxGTK)

Reported by: alexandrub Owned by: pcor
Priority: high Milestone:
Component: wxGTK Version: stable-latest
Keywords: Cc: pcor
Blocked By: Blocking:
Patch: no


To reproduce, change the toolbar sample to use wxOwnerDrawnCombBox instead of wxComboBox (just replace the keywords) and link with -lwx_gtk2u_adv-2.9.

It is possibly similar to the issue related in Ticket #3482 and fixed in lower releases.

The problem can be traced to wxComboCtrlBase::ShowPopup() -> wxWindowGtk::DoGetPosition() which returns correctly only if the parent of the widget is a WX_PIZZA, otherwise returns (0, 0). Copying the solution from 2.8 makes it work but with a hack: in our code I define initial position to (-2, -2) because wxDefaultPosition (-1, -1) gets reset to (0, 0) somewhere in-between.

Any pointers to the clean solution or why this didn't make it to 2.9? When this is solved, a wxOwnerDrawnCombBox should be added to the sample as a regression test.

Attachments (1)

ownerdrawn_fix.patch download (945 bytes) - added by alexandrub 5 years ago.
Patch to wxWindowGTK::DoGetPosition() from 2.8

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by alexandrub

Patch to wxWindowGTK::DoGetPosition() from 2.8

comment:1 Changed 5 years ago by vadz

  • Cc pcor added

I don't understand at all why should m_x == -1 && m_y == -1 case be handled specially, would you know the reason for this by chance? Could it be that the hack added to fix #3482 was compensating for some other bug elsewhere?

FWIW this code was removed by Paul in r70734 and I'm hesitant to restore it without understanding why is it needed.

Of course, fixing the bug would still be nice...

comment:2 Changed 5 years ago by alexandrub

I don't see any other reason either (except treating the case only once, at position init) and in fact I removed it in application code because of some side effects. The gtk-related code resides now in an else for 'if (WX_IS_PIZZA(parent))'. Not sure if this is correct though.

I don't have more info on the subject at this moment.

comment:3 Changed 5 years ago by pcor

  • Owner set to pcor
  • Status changed from new to accepted

comment:4 Changed 5 years ago by PC

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

(In [74074]) update position for widgets in native containers, fixes #15231

Note: See TracTickets for help on using tickets.