Page 1 of 1

wxDialog is displayed in the background only on Mac

Posted: Mon Sep 30, 2019 12:58 pm
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++"

Re: wxDialog is displayed in the background only on Mac

Posted: Mon Sep 30, 2019 2:29 pm
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.

Re: wxDialog is displayed in the background only on Mac

Posted: Mon Sep 30, 2019 3:32 pm
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 ?

Re: wxDialog is displayed in the background only on Mac

Posted: Mon Sep 30, 2019 5:21 pm
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.

Re: wxDialog is displayed in the background only on Mac

Posted: Mon Sep 30, 2019 5:31 pm
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.

Re: wxDialog is displayed in the background only on Mac

Posted: Mon Sep 30, 2019 5:40 pm
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.

Re: wxDialog is displayed in the background only on Mac

Posted: Tue Oct 01, 2019 8:16 am
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?

Re: wxDialog is displayed in the background only on Mac

Posted: Wed Oct 02, 2019 2:19 pm
by deepti
Can someone please help me with this issue please ?

Re: wxDialog is displayed in the background only on Mac

Posted: Wed Oct 02, 2019 4:45 pm
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

Re: wxDialog is displayed in the background only on Mac

Posted: Thu Oct 03, 2019 5:24 pm
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.

Re: wxDialog is displayed in the background only on Mac

Posted: Fri Oct 04, 2019 10:43 am
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!

Re: wxDialog is displayed in the background only on Mac

Posted: Fri Oct 04, 2019 10:51 am
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.