MFC focus question
-
I have a question in regards to, if there is a built in function in mfc i can overload that gets called when a dialog is brought back to focus after a DoModal() operation. I end the modal dialog with OnOK(). the OnPaint() starts to paint again when its brought back to focus, but is there is a cleaner way to check for this event? Thanks
-
I have a question in regards to, if there is a built in function in mfc i can overload that gets called when a dialog is brought back to focus after a DoModal() operation. I end the modal dialog with OnOK(). the OnPaint() starts to paint again when its brought back to focus, but is there is a cleaner way to check for this event? Thanks
I'm not sure what you're asking... As soon as DoModal() returns, the modal dialog has been dismissed. While the modal dialog was displayed, other windows should still get WM_PAINT messages. If you've halted painting before calling DoModal(), then just start painting again when DoModal() returns. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I'm not sure what you're asking... As soon as DoModal() returns, the modal dialog has been dismissed. While the modal dialog was displayed, other windows should still get WM_PAINT messages. If you've halted painting before calling DoModal(), then just start painting again when DoModal() returns. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
The initial dialog does not paint when there is a modal dialog in focus, because i run the app in full screen. But if there are no functions that i can use that deals with "OnFocus", WM_PAINT works, i just need to be carefull with it. Thanks Fredrick
-
I have a question in regards to, if there is a built in function in mfc i can overload that gets called when a dialog is brought back to focus after a DoModal() operation. I end the modal dialog with OnOK(). the OnPaint() starts to paint again when its brought back to focus, but is there is a cleaner way to check for this event? Thanks
You could use the WM_ACTIVATE[^] message. Use a handler which looks something like this:
void CDialogAppDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CDialog::OnActivate(nState, pWndOther, bMinimized);if (nState==WA\_ACTIVE || nState==WA\_CLICKACTIVE) { // Do stuff here! }
}
Steve
-
You could use the WM_ACTIVATE[^] message. Use a handler which looks something like this:
void CDialogAppDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CDialog::OnActivate(nState, pWndOther, bMinimized);if (nState==WA\_ACTIVE || nState==WA\_CLICKACTIVE) { // Do stuff here! }
}
Steve
Perfect, just what i needed. Thanks!