Search code examples
wxwidgets

Popup wxPopupTransientWindow with wxDialog as parent on Mac


I have a modal wxDialogBox with a push button. On click on this push button, I am launching a wxPopupTransientWindow. This wxPopupTransientWindow has some controls like wxTextCtrl and wxButton.

This is working perfectly under MSW, on Mac on button click wxPopupTransientWindow is get popups but wxPopupTransientWindow is not accessible. wxDialogBox blocks the wxPopupTransientWindow as it is the modal dialog.

I do know how can I make wxPopupTransientWindow accessible?


Solution

  • This bug is already reported (http://trac.wxwidgets.org/ticket/17406)

    After reading the description, I came to know that if I create wxPopupWindow/wxPopupTransientWindow into modal wxDialog constructor, then wxDialog is added as it's parent. So do not create wxPopupWIndow in modal wxDialog constructor.

    I found 2 ways to deal with issue:

    1. Do not create in wxDialog constructor. Create wxPopupWindow when you need it (i.e. on mouse hover, button click etc.)

    2. If want to create one time in constructor and use it later many time, use CallAfter to create it. CallAfter will schedule wxPopupWindow creation for next round after constructor call finishes.

    I know this is not a good fix, but this is what I found as immediate solution.