Dialog Window's control disappear when i drag the window offscreen

Started by
16 comments, last by tonemgub 10 years, 1 month ago

So I have a dialog window,but if I drag part of it offscreen,the controlls disappear. If I keep getting the mouse over the window parts of them will reappear.

What could be the problem?

Advertisement

Show your message loop and DialogProc.

Could be that you have a HWND set in Get/PeekMessage.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>


INT_PTR CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{


	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;
	UNREFERENCED_PARAMETER(lParam);
	switch (message)
	{
	case WM_INITDIALOG:
		return (INT_PTR)TRUE;

	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDOK:

			break;
		}
		break;
		
case WM_PAINT:
		hdc = BeginPaint(hDlg, &ps);
		// TODO: Add any drawing code here...
		EndPaint(hDlg, &ps);
		manager.Clear();
		
		break;
case WM_DESTROY:
		PostQuitMessage(0);
		break;
case WM_CLOSE:
		PostQuitMessage(0);
	break;

	}
	return (INT_PTR)FALSE;
}

manager.Clear() is a function call to directx to clear the backbuffer.

Sorry. Ignore this. Not enough coffee.

Blah--> Your dialog proc should return DefWindowProc for any unprocessed commands, not 0. Any processed commands should return 0.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Ok,I corrected that but the controls still disappear...

See my comment above, now rated: "Blah."

Do you have any custom controls or subclassed controls?

EDIT: Does it appear properly if you comment out the call to manager.clear()?

EDIT2: Just to make sure you understand the stupidity of a previous post of mine, the dialog proc should return TRUE if it processes a command, and FALSE if it doesn't. E.g., you might try NOT calling BeginPaint/EndPaint and just return FALSE (or don't include it at all). Also, though you may just be testing it, the IDOK (and maybe IDCANCEL) is normally processed by calling EndDialog and returning TRUE. Returning TRUE (normally) applies to all control messages.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

So the manager.Clear() is the problem.

But where should I place it?!

We may have cross-posted. I am really sorry for my previous comment about DefWindowProc. That comment was INCORRECT. Returning FALSE for unprocessed commands and TRUE for processed commands is the correct way to do it. See my later post, just above your last.

Just FYI, the default dialog procedure is owned by Windows. It processes all commands, sending most (but not all) to YOUR dialog proc. The return value from YOUR proc tells the default proc whether you handled it or not.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

so i return true for every message i process, and return false if the message is not processed,ok.

but,im still having the problem. And removing the clear function fixed the problem...but where should i put the clear function?!

I have an idea what it does, but why do you call it from a modal dialog? Can it wait until the dialog closes?

If you want to interface with another object from a dialog (e.g., getting settings, etc., which are to be displayed immediately), you should use a modeless dialog.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement