Skip to content

Commit

Permalink
Don't use the mainframe as a parent if hidden, try to use the active …
Browse files Browse the repository at this point in the history
…doc window first
  • Loading branch information
Blake-Madden committed Nov 24, 2024
1 parent 29d7ee6 commit da787f5
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/ui/mainframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,21 @@ wxDocTemplate* Wisteria::UI::DocManager::SelectDocumentType(wxDocTemplate** temp
docNames.Add(data[i]->GetDescription());
}
// find a suitable parent window
RadioBoxDlg radioDlg(wxTheApp->GetTopWindow(), _(L"Select Project Type"), wxEmptyString,
wxWindow* parentWindow =
[this]()
{
if (wxTheApp->GetTopWindow() != nullptr && wxTheApp->GetTopWindow()->IsShown())
{
return wxTheApp->GetTopWindow();
}
else if (GetCurrentDocument() != nullptr &&
GetCurrentDocument()->GetDocumentWindow() != nullptr)
{
return GetCurrentDocument()->GetDocumentWindow();
}
return wxTheApp->GetTopWindow();
}();
RadioBoxDlg radioDlg(parentWindow, _(L"Select Project Type"), wxString{},
_(L"Project types:"), _(L"New Project"), docNames, docDescriptions);
if (radioDlg.ShowModal() == wxID_OK)
{
Expand Down

0 comments on commit da787f5

Please sign in to comment.