void wxDialog::Init()
{
m_oldFocus = (wxWindow *)NULL;
-
m_isShown = FALSE;
-
m_modalData = NULL;
-
+ m_endModalCalled = FALSE;
+
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
}
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
return FALSE;
-
- SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+ if (!m_hasFont)
+ SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
return TRUE;
}
InitDialog();
}
- if ( show && IsModal() )
+ // EndModal may have been called from InitDialog handler,
+ // which would cause an infinite loop if we didn't take it
+ // into account
+ if ( show && IsModal() && !m_endModalCalled )
{
// modal dialog needs a parent window, so try to find one
if ( !GetParent() )
// a special version for Show(TRUE) for modal dialogs which returns return code
int wxDialog::ShowModal()
{
+ m_endModalCalled = FALSE;
if ( !IsModal() )
{
SetModal(TRUE);
// dialogs and should work for both of them
void wxDialog::EndModal(int retCode)
{
+ m_endModalCalled = TRUE;
SetReturnCode(retCode);
Show(FALSE);