wxDialog is displayed in the background 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.
Post Reply
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

wxDialog is displayed in the background only on Mac

Post by deepti »

Hi,

I have a wxDialog instance (with parent set to NULL). It is created on click of a popup menu option of wxTaskbarIcon instance.
On Show(), it ends up being displayed behind some other application windows that are open, and is not shown in the front. This works perfectly on Windows.

I had brought up this issue earlier as well. But haven't found a solution yet.
This same issue is even seen in the sample taskbar app under "samples" folder of wxWidgets. In this case, on clicking the "Restore main window" option, the dialog is not shown on top.. it sits behind some windows.
Our app has been developed very similar to this sample app.
So, is this issue solvable?

Setting the flag to wx_STAY_ON_TOP solves the problem, but will not be so useful, since there are other UI options and on click of these options, newer wxDialog instances need to be displayed on top of the first.

Please help!

1. wx version is 3.1.1 (issue is seen even on 3.1.0)
2. OS is Mac High Sierra 10.12
3. wx was configured using the following command:

./configure --disable-shared --enable-unicode --with-libjpeg=builtin --with-libpng=builtin --with-cocoa CXXFLAGS="-std=c++11 -stdlib=libc++ " OBJCXXFLAGS="-std=c++11 -stdlib=libc++" LDFLAGS="-stdlib=libc++"
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDialog is displayed in the background only on Mac

Post by ONEEYEMAN »

Hi,
What type of dialog is it - a custom one or a standard one?
Also - why do you need a non-modal dialog? It is better to use wxFrame for it...

Thank you.
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxDialog is displayed in the background only on Mac

Post by deepti »

Hi @ONEEYEMAN,

Thank you for your response.
It is a custom dialog derived from wxDialog.
I just tried it with wxFrame and it still does not work, unless the wxSTAY_ON_TOP attribute is used.

And the behavior is the same in the sample app under "samples" as well.

Is there any other way to go about this, without using the wxSTAY_ON_TOP ?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDialog is displayed in the background only on Mac

Post by ONEEYEMAN »

Hi,
Try to rebuild the library and pass the option "--with-macosx-version-min=10.9" (without quotes).
After rebuilding try to replicate it inside the dialogs sample.

Thank you.
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxDialog is displayed in the background only on Mac

Post by deepti »

Hi @ONEEYEMAN,

thank you for your response.
That option should go into the ./configure command, am i correct ?
After rebuilding try to replicate it inside the dialogs sample.
Check whether the issue resolves in the sample taskbar app - is this what you imply?

Thanks in advance.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDialog is displayed in the background only on Mac

Post by ONEEYEMAN »

Hi,
deepti wrote: Mon Sep 30, 2019 5:31 pm Hi @ONEEYEMAN,

thank you for your response.
That option should go into the ./configure command, am i correct ?
Yes, this is correct. That's why I said - rebuuild the library.
deepti wrote: Mon Sep 30, 2019 5:31 pm
After rebuilding try to replicate it inside the dialogs sample.
Check whether the issue resolves in the sample taskbar app - is this what you imply?

Thanks in advance.
Yes - whatever sample you used for testing before.
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxDialog is displayed in the background only on Mac

Post by deepti »

Hello @ONEEYEMAN,

I did try with the option "--with-macosx-version-min=10.9".
However, there is no change in behavior.
I recall having solved a similar issue even with Electron app, only on Mac.
The Electron app's window just would not be shown on top, until the following logic was written in the app.

if (process.platform == 'darwin') {
mainWindow.setAlwaysOnTop(true, "floating", 5);
mainWindow.setVisibleOnAllWorkspaces(true);
mainWindow.setFullScreenable(false);
}

The last parameter in "setAlwaysOnTop" indicates the number of other windows that can be open underneath. If 6 other windows/apps are open and then my Electron app is open, it will still not show it on top (since the parameter has been set to 5 above).
I observed a somewhat similar behavior even with the wxWidgets app. If there is one other window open, my app and the sample app still do show up on top. But if there are 2 or more other windows already open, then my app goes underneath them.
Do we have something similar to "setAlwaysOnTop" in wxWidgets?
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxDialog is displayed in the background only on Mac

Post by deepti »

Can someone please help me with this issue please ?
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDialog is displayed in the background only on Mac

Post by doublemax »

Did you build an application bundle?
https://wiki.wxwidgets.org/WxMac-specif ... ion_bundle

If yes and if it happens with an unmodified sample, please open a bug report at http://trac.wxwidgets.org
Use the source, Luke!
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxDialog is displayed in the background only on Mac

Post by deepti »

Hi @doublemax,

The application bundle is in place and it's been working for many years now.
It happens even with the sample taskbar app. So, will need to raise a ticket for this.
Thank you for your reply.
deepti
Earned some good credits
Earned some good credits
Posts: 115
Joined: Tue Jul 17, 2018 5:38 pm

Re: wxDialog is displayed in the background only on Mac

Post by deepti »

Hi @doublemax,

I have opened the ticket https://trac.wxwidgets.org/ticket/18518
But could you give me an idea of a timeline for the resolution? Depending on that we could decide whether i should wait for the fix, or go ahead with a work-around.
Thank you again!
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDialog is displayed in the background only on Mac

Post by doublemax »

But could you give me an idea of a timeline for the resolution?
Impossible to tell. Anywhere from a week to never. Especially since there are few people working on OSX.
Use the source, Luke!
Post Reply