-// HWND hWnd = (HWND) GetHWND();
-// RECT rect;
-// ::GetClientRect(hWnd, &rect);
-//
-// RECT rect2;
-// GetWindowRect(hWnd, &rect2);
-//
- // Find the difference between the entire window (title bar and all)
- // and the client area; add this to the new client size to move the
- // window
-// int actual_width = rect2.right - rect2.left - rect.right + width;
-// int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
+ if (!bShow && m_modalData )
+ {
+ // we need to do this before calling wxDialogBase version because if we
+ // had disabled other app windows, they must be reenabled right now as
+ // if they stay disabled Windows will activate another window (one
+ // which is enabled, anyhow) when we're hidden in the base class Show()
+ // and we will lose activation
+ m_modalData->ExitLoop();
+#if 0
+ if (m_pWindowDisabler)
+ {
+ delete m_pWindowDisabler;
+ m_pWindowDisabler = NULL;
+ }
+#endif
+ }
+
+ if (bShow)
+ {
+ // this usually will result in TransferDataToWindow() being called
+ // which will change the controls values so do it before showing as
+ // otherwise we could have some flicker
+ InitDialog();
+ }
+
+ wxDialogBase::Show(bShow);
+
+ wxString title = GetTitle();
+ if (!title.empty())
+ ::WinSetWindowText((HWND)GetHwnd(), (PSZ)title.c_str());
+
+ if ( bShow )
+ {
+ // dialogs don't get WM_SIZE message after creation unlike most (all?)
+ // other windows and so could start their life non laid out correctly
+ // if we didn't call Layout() from here
+ //
+ // NB: normally we should call it just the first time but doing it
+ // every time is simpler than keeping a flag
+ Layout();
+ }
+
+ return true;
+} // end of wxDialog::Show