MDI application, window title bar not reflecting focus
Author |
Message |
Andreas Stuebinge #1 / 6
|
 MDI application, window title bar not reflecting focus
Hello, on moving an MFC application (written in VC++ 6) from Windows 2000 to XP the following problem occured: After opening some MDI child windows inside of the application and clicking with the mouse on each of the child windows, the title bar does not reflect the focus. The title bar stays dark blue, even if the window has no longer focus. Only after moving the active window over an in-active window, the title bar gets updated (i.e. light blue). After de-selecting all the fancy XP drawing stuff (i.e. get the Windows 2000 look again), all title bar updates are ok. Does anybody has some hints/keywoards to follow? Thanks a lot. Ciao, Andreas
|
Sun, 12 Dec 2004 10:50:47 GMT |
|
 |
David Lownde #2 / 6
|
 MDI application, window title bar not reflecting focus
Quote: >on moving an MFC application (written in VC++ 6) from Windows 2000 to XP >the following problem occured: >After opening some MDI child windows inside of the application and clicking >with the mouse on each of the child windows, the title bar does not reflect >the focus. The title bar stays dark blue, even if the window has no longer >focus. Only after moving the active window over an in-active window, the >title bar gets updated (i.e. light blue). >After de-selecting all the fancy XP drawing stuff (i.e. get the Windows 2000 >look again), all title bar updates are ok.
Andreas, Does this problem occur with a default AppWizard created MDI application, or is it a consequence of something specific in your application? Let us know if you can reproduce it with a default MDI app. Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq My address is altered to discourage junk mail. Please post responses to the newsgroup thread, there's no need for follow-up email copies.
|
Sun, 12 Dec 2004 23:23:08 GMT |
|
 |
Andreas Stuebinge #3 / 6
|
 MDI application, window title bar not reflecting focus
Hi, Quote:
>>on moving an MFC application (written in VC++ 6) from Windows 2000 to XP >>the following problem occured: >>After opening some MDI child windows inside of the application and clicking >>with the mouse on each of the child windows, the title bar does not reflect >>the focus. The title bar stays dark blue, even if the window has no longer >>focus. Only after moving the active window over an in-active window, the >>title bar gets updated (i.e. light blue). >>After de-selecting all the fancy XP drawing stuff (i.e. get the Windows 2000 >>look again), all title bar updates are ok. > Does this problem occur with a default AppWizard created MDI > application, or is it a consequence of something specific in your > application?
Unfortunately not, as I just checked. My problem does not happen with an AppWizard generated MDI application. My application started about 4 years ago (without me), so I'm not too firm on why and how something was done. I already checked all member functions of the different MFC-derived classes (i.e. MDIChildWnd, CScrollView, CMDIFrameWnd.) And no, I found no member function (a'la OnNcPaint, ...) beeing not properly overridden. Who or what routine is responsible for drawing the window bar of a child window? Why does it work without the fancy stuff, but not with it? Do you have some keywords to look for in MSDN (the right keyword often contains the solution already ;-)) Maybe this get's me on the right track again? Thanks a lot. Ciao, Andreas
|
Mon, 13 Dec 2004 16:10:45 GMT |
|
 |
David Lownde #4 / 6
|
 MDI application, window title bar not reflecting focus
Quote: >> Does this problem occur with a default AppWizard created MDI >> application, or is it a consequence of something specific in your >> application? >Unfortunately not, as I just checked. My problem does not happen with an AppWizard >generated MDI application.
OK, so you need to identify what your application is doing that's giving rise to the problem. Quote: >My application started about 4 years ago (without me), so I'm not too firm on why >and how something was done. I already checked all member functions of the different >MFC-derived classes (i.e. MDIChildWnd, CScrollView, CMDIFrameWnd.) And no, I found >no member function (a'la OnNcPaint, ...) beeing not properly overridden. >Who or what routine is responsible for drawing the window bar of a child window?
Like you, I presume it's WM_NCPAINT - though I think I recall some old MSJ article mentioning that aspects are painted at other times too. KB article Q99046 mentions WM_NCPAINT, WM_NCACTIVATE, WM_SETTEXT, and WM_SYSCOMMAND messages. Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq My address is altered to discourage junk mail. Please post responses to the newsgroup thread, there's no need for follow-up email copies.
|
Mon, 13 Dec 2004 21:08:47 GMT |
|
 |
Andreas Stuebinge #5 / 6
|
 MDI application, window title bar not reflecting focus
Hi again, Quote:
>>>Does this problem occur with a default AppWizard created MDI >>>application, or is it a consequence of something specific in your >>>application? >>Unfortunately not, as I just checked. My problem does not happen with an AppWizard >>generated MDI application. > OK, so you need to identify what your application is doing that's > giving rise to the problem.
Well, up until now I could not identify the real problem with my application. However, the following fix seems to solve my problem: void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) { CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd); // Fix for XP: On deactivate do a redraw of non-client-area // if (!bActivate) { RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE ); } Quote: }
Using this the title bars of my ChildFrames get de-activated. Ciao, Andreas
|
Tue, 14 Dec 2004 15:53:34 GMT |
|
 |
David Lownde #6 / 6
|
 MDI application, window title bar not reflecting focus
Quote: >Well, up until now I could not identify the real problem with my application. >However, the following fix seems to solve my problem: >void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) >{ > CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd); > // Fix for XP: On deactivate do a redraw of non-client-area > // > if (!bActivate) { > RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE ); > } >} >Using this the title bars of my ChildFrames get de-activated.
But doing this is just forcing the redraw - unless you have some other code in your application that's circumventing the default operation, I don't think you ought to need to do it. Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq My address is altered to discourage junk mail. Please post responses to the newsgroup thread, there's no need for follow-up email copies.
|
Tue, 14 Dec 2004 19:07:31 GMT |
|
|
|