Center Dialog On Screen
Posted: Fri Mar 15, 2019 10:37 am
Hey guys,
I want my application to send a message to the user on start under a certain condition and I would like to have that message in the center of my screen.
Problem is, that there can (but must not) be a little frame in the corner already. And since this is the first frame created, it is the TopLevelWindow and my message desperately wants to show in the center of that frame (which is in the corner).
First I had
I then tried several other things, none of which made any difference:
It does even ignore a postion, if I provide one:
Anything else I can do to ignore a wxFrame and center a dialog?
Thanks!
Cheers Natu
I want my application to send a message to the user on start under a certain condition and I would like to have that message in the center of my screen.
Problem is, that there can (but must not) be a little frame in the corner already. And since this is the first frame created, it is the TopLevelWindow and my message desperately wants to show in the center of that frame (which is in the corner).
First I had
Code: Select all
wxMessageBox(wxString::Format("My Msg"), GetAPP_Name(), 4 | wxICON_EXCLAMATION, NULL);
Code: Select all
//with and without wxDIALOG_NO_PARENT, wxCENTRE, wxICON_EXCLAMATION
wxMessageDialog md(NULL, wxString::Format("My Msg"), GetAPP_Name(), wxOK | wxCENTRE | wxDIALOG_NO_PARENT | wxICON_EXCLAMATION);
md.CenterOnScreen(); // or md.Center()
md.ShowModal(); //or md.Show()
Code: Select all
wxPoint pt(300, 300);
wxMessageDialog md(NULL, wxString::Format("My Msg"), GetAPP_Name(), wxOK | wxDIALOG_NO_PARENT | wxICON_EXCLAMATION, pt);
//or md.SetPosition(pt);
md.ShowModal();
Thanks!
Cheers Natu