wxMessageBox and wxMessageDialog - go behind the dialog only on Mac

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
deepti
Experienced Solver
Experienced Solver
Posts: 63
Joined: Tue Jul 17, 2018 5:38 pm

wxMessageBox and wxMessageDialog - go behind the dialog only on Mac

Postby deepti » Wed Sep 26, 2018 4:45 pm

Hi All,

I have to fix this issue urgently for a code freeze, and something annoying has cropped up on Mac again.

Both wxMessageBox and wxMessageDialog go behind a modeless dialog. This issue is only on Mac.
Both the following ones dont work. The dialog which is displaying the message box is modeless. It works fine for Modal dialogs.

Code: Select all

wxMessageBox("Please note Time Active Controls will not be active in Document Edit Only Mode", "Information", wxICON_INFORMATION | wxOK);


Code: Select all

wxMessageDialog* msgDlg = new wxMessageDialog(this, "Please note Time Active Controls will not be active in Document Edit Only Mode", "Information", wxOK| wxICON_INFORMATION);

msgDlg->ShowModal();

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1789
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxMessageBox and wxMessageDialog - go behind the dialog only on Mac

Postby PB » Wed Sep 26, 2018 4:52 pm

Which wxWidgets version are you using?

I am not using OSX but I do remember a couple of issues with modal dialogs like this being reported, they may have been fixed in the master branch...

deepti
Experienced Solver
Experienced Solver
Posts: 63
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxMessageBox and wxMessageDialog - go behind the dialog only on Mac

Postby deepti » Wed Sep 26, 2018 4:59 pm

i am using 3.1.0 version of wxWidgets. Is there any other way of achieving the same action as a message box? I need to fix this in the next couple of hours maximum :(

And this issue is seen only in modeless dialogs...not modal.

User avatar
doublemax
Moderator
Moderator
Posts: 12886
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxMessageBox and wxMessageDialog - go behind the dialog only on Mac

Postby doublemax » Wed Sep 26, 2018 6:43 pm

I can't test under OSX myself. Things i would try:

If you know which dialog is open at that moment, use that window as parent for wxMessageDialog / wxMessageBox.

Use wxGenericMessageDialog instead of wxMessageDialog

Use SetWindowStyleFlag to add the wxSTAY_ON_TOP style flag after creating. (I don't think passing this into the style parameter will work.)


[Even if i sound like a broken record: Dialogs should always be modal, if you want something non-modal, use wxFrame. I know officially both things are supported, but i always see people having problems with modeless dialogs.]
Use the source, Luke!

deepti
Experienced Solver
Experienced Solver
Posts: 63
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxMessageBox and wxMessageDialog - go behind the dialog only on Mac

Postby deepti » Wed Sep 26, 2018 6:48 pm

Thanks a lot for your reply.
I've already set the parent of the message dialog to the dialog invoking it, still doesnt work.

wxSTAY_ON_TOP is not implemented for OSX, as per the documentation.

[Even if i sound like a broken record: Dialogs should always be modal, if you want something non-modal, use wxFrame. I know officially both things are supported, but i always see people having problems with modeless dialogs.]


Will keep this in mind for the next time. But that dialog has been around for a long time now, so cant change it easily.

Use wxGenericMessageDialog instead of wxMessageDialog


Dont think it might help, but will give it a shot still.

User avatar
doublemax
Moderator
Moderator
Posts: 12886
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxMessageBox and wxMessageDialog - go behind the dialog only on Mac

Postby doublemax » Wed Sep 26, 2018 7:35 pm

Can you hide the dialog and show afterwards as a temporary solution?

BTW: Does the messagebox/dialog come to the front when you click it?
Use the source, Luke!

deepti
Experienced Solver
Experienced Solver
Posts: 63
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxMessageBox and wxMessageDialog - go behind the dialog only on Mac

Postby deepti » Wed Sep 26, 2018 7:59 pm

BTW: Does the messagebox/dialog come to the front when you click it?


Yes it does..

So, i made the dialog Modal and it works. It was modeless because there was no need for it to be modal. But, just to solve this issue, i made it modal :-|

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1789
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxMessageBox and wxMessageDialog - go behind the dialog only on Mac

Postby PB » Thu Sep 27, 2018 5:52 am

deepti wrote:And this issue is seen only in modeless dialogs...not modal.


I meant wxMessageDialog which I assumed being modal. As I wrote above, IIRC the issues were with modal dialogs being displayed with a modeless dialog open. I think those issues can be easily found on wx-dev.

BTW, generally speaking I do not see advantage of using wxWidgets 3.1 over 3.1.1 or even master.


Return to “Platform Related Issues”

Who is online

Users browsing this forum: No registered users and 2 guests