wxDialog launched behind application

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Dec 05, 2017 9:10 am

wxDialog launched behind application

Post by preethis » Tue Nov 05, 2019 6:54 am

Code snippet inside SampleWrapper.exe:

wxDialog *dlgTmp = new wxDialog(NULL, -1, "", wxDefaultPosition, wxSize(0, 0));
wxWindow *pWin = dlgTmp;

long ret = ShowUI(pWin, strTitle, srtID, defaultmap, nDlgRetCode, strOut);

Our Project UI is in Angular JS which internally uses node.js that will call C++ function present in one dll which will start SampleWrapper.exe.
This SampleWrapper.exe should launch a dialog on top of our project UI. Since our main UI is in Angualr and JS, we c an't pass this UI handle as parent Window ID, So we created a dummy dialog of size 0,0 and passing this handle to ShowUI which used this dummy dialog handle as parent id and will launch another dialog. This code works fine with Windows.
But when we use the same in MAC, this dialog is launched behind our Project UI.
MAC: xCode we are using to create an application.

Please if anyone point out what is the mistake here/ any other solution to do the same in MAC.

Super wx Problem Solver
Super wx Problem Solver
Posts: 268
Joined: Tue Oct 18, 2016 2:31 pm

Re: wxDialog launched behind application

Post by alys666 » Tue Nov 05, 2019 7:47 am

if i remember this function makes a window the topmost, calling window manager.
virtual void wxWindow::Raise();
also you do not need to allocate dialog on the heap. just on the stack

Raise works only for wxTopLevelWindow derived classes, but wxDialog is that derived.
ubuntu 16.04, wxWidgets 3.0.4

Post Reply