|  | 
| CXTPCommandBarsFrameHook and Tile Windows | 
| Post Reply   | 
| Author | |
| ABtdk   Newbie   Joined: 17 April 2025 Status: Offline Points: 10 |  Post Options  Thanks(0)  Quote  Reply  Topic: CXTPCommandBarsFrameHook and Tile Windows Posted: 02 May 2025 at 5:57pm | 
| 
   I have made classes that derive from a class identical to CChildFrame in the example RibbonMDISample. After EnableFrameTheme is called in OnUpdateMDIChildrenTheme, the Cascade and Tile Windows commands are not working in the main frame class. This doesn't seem to happen in the sample project.
    | |
|  | |
| ABtdk   Newbie   Joined: 17 April 2025 Status: Offline Points: 10 |  Post Options  Thanks(0)  Quote  Reply  Posted: 05 May 2025 at 10:34am | 
| 
   I narrowed it down to CXTPCommandBarsFrameHook::RefreshFrameStyle() being called. I also forgot to mention I've tried this in v22.1.0 and v24.1.0
    | |
|  | |
| ABtdk   Newbie   Joined: 17 April 2025 Status: Offline Points: 10 |  Post Options  Thanks(1)  Quote  Reply  Posted: 09 May 2025 at 10:34am | 
| The issue was being caused by  ::SendMessage(m_hwndSite, WM_NCCALCSIZE, FALSE, XTPToLPARAM(&rc)); being called when the child frame didn't have the WS_DLGFRAME flag in its style (which happens in CXTPCommandBarsFrameHook::RefreshFrameStyle). I solved the issue by making this: BOOL CMainFrame::OnWindowArrangeCommand(UINT nCmd) { if (!GetSafeHwnd()) return FALSE; CWnd* pWnd = GetActiveFrame(); if (pWnd != this) { CChildFrame* pChildFrame = dynamic_cast<CChildFrame*>(pWnd); while (pChildFrame) { pChildFrame->PrepareForRearrange(); pChildFrame = dynamic_cast<CChildFrame*>(pChildFrame->GetNextWindow()); } } const BOOL bRet = CMDIFrameWnd::OnMDIWindowCmd(nCmd); UpdateMDIChildrenTheme(); return bRet; } and void CChildFrame::PrepareForRearrange() { m_bLockNCPaint++; RECT rc = CXTPWindowRect(m_hwndSite); ::SendMessage(m_hwndSite, WM_NCCALCSIZE, FALSE, XTPToLPARAM(&rc)); m_bLockNCPaint--; RedrawFrame(); } | |
|  | |
| Post Reply   | |
| Tweet | 
| Forum Jump | Forum Permissions  You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |