In our OnCmdMsg method we sometimes have to trap the update UI call for XTP_ID_MENUBAR_CLOSE and call pCmdUI->Enable( FALSE ). This results in the application's "X" (close) icon at the top of the frame being grayed out (as expected). But later after we start calling Enable( TRUE ), the close icon never is drawn enabled (have to exit and restart the app).
I have set a break in CXTPMenuBar::CControlMDIButton::Draw and stepped all the way thru the code until I reaced CXTPRibbonTheme::DrawRectangle. In that code the "nState" variable is always set to -1 and no icon is drawn (even before I disable the control). I noted that for the controls related to the mdi window that is open (i.e., not the controls on the app frame), when I move over them, the same code is called and nState is not set to -1 and the call to DrawImage is made.
So can someone point me to where the actual "X"/close icon is actually drawn by CJ so I can see what happens after I call Enable( FALSE ) and then later call Enable( TRUE ) on the control so I can compare what the drawing code is doing when I never call Enable( FALSE ) (i.e. I only call Enable( TRUE ) ).
Also, I have noticed a side issue when I mouse over the app frame's close icon. If I move over it and it starts animation to "glow" the icon and I quickly move out of the frame caption area, the icon never displays in the normal mode (the glow does not go away) until I move my mouse back up to the frame's caption area. I am thinking that our command update UI is taking too long and perhaps CJ never sees the mouse leave the close icon and caption area of the frame.
Update: - I found that when we call ::EnableMenuItem to disable and gray out the control, the frame window immediately redraws the control (did not find where the redraw occurred). I also found that when we call ::EnableMenuItem to reenable the control, that sometimes it immediately redraws as enabled (as it should). But If I tab to another mdi doc and back, when I call ::EnableMenuItem, nothing happens. So now perhaps CJ doesn't even draw the frame's system icons?
Update: - I found that when the Vista Aero theme is on, CJ does not create the CControlCaptionButton objects. So I turned Aero off and CJ creates the controls. Now as I modify the SC_CLOSE item state in my system menu, CJ displays what I expect. I am beginning to believe this is an Aero issue.
Oleg can you confirm that with Aero, CJ leaves the system close caption button display to Windows?
|