Modal dialogs with native title bar


#1

It seems that the native title bar recieves messages although there is a modal dialog box on top. If I click the “Close” button, then exit the dialog, then the whole application closes…


#2

That doesn’t seem to happen in the juce demo… Any clues about how I could reproduce it?


#3

Use AlertWindow::showNativeDialogBox as the modal dialog


#4

How about just tweaking juce_win32_Windowing.cpp:

case WM_CLOSE: if (! component->isCurrentlyBlockedByAnotherModalComponent()) handleUserClosingWindow(); return 0;


#5

Yup! That works. Also:

              case WM_SYSCOMMAND:
						if (component->isCurrentlyBlockedByAnotherModalComponent() )
						{
							return 0;
						}

						switch (wParam & 0xfff0)
						{
						case SC_CLOSE:
							if (hasTitleBar())
							{
								PostMessage (h, WM_CLOSE, 0, 0);

does the trick.

Thanks Jules!