[solved] CXTPTabClientWnd::OnMDIDestroy bug? |
Post Reply |
Author | |
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 891 |
Post Options
Thanks(2)
Posted: 05 March 2018 at 4:55pm |
Is this an oversight/bug?
In CXTPTabClientWnd::OnMDIDestroy, the method always calls either ActivateNextItem or ActivateNextTopmostItem. So what happens if I have, for example, three documents opened and I hit the "x" on the tab of a window that is not the active MDI window? CodeJock deactivates the active window and activates another window depending on the tab order. This seems wrong since clicking the "x" on an inactive window does not MDI activate that window (which happens to be one of the big benefits in our system to using MDI tabs). To see this open three documents. We are using "new tabs on the left flag". Activate the doc that goes with the right-most tab. Now hit the "x" on the middle tab. The document associated with the left-most tab activates and the active document deactivates. Since the document being closed was not active, why pick another document to activate? I "fixed" this by getting the active window and seeing if it is the one being closed. Only if it is do I activate another document. ... CWnd* pActive = MDIGetActive(); bool bClosingActive = false; if( pActive ) { if( pActive->GetSafeHwnd() == (HWND)wParam ) { bClosingActive = true; } } if( bClosingActive ) { if (m_afterCloseTabPosition == xtpWorkspaceActivateNextToClosed) ActivateNextItem(FindItem((HWND)wParam)); else if (m_afterCloseTabPosition == xtpWorkspaceActivateTopmost) // ActivateNextTopmostItem(FindItem((HWND)wParam)); } ... |
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 891 |
Post Options
Thanks(0)
|
Ignore that "//" in front of ActivateNextTopmostItem. I was experimenting with the code since we have our own logic to determine which window to activate. Any CJ change would want to keep that line!
|
|
olebed
Admin Group Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Hello RDHD, You are right, it is bug. I have added your changes to CXTPTabClientWnd::OnMDIDestroy. Note that ActivateNextTopmostItem() call there need for handling case when used several tab groups. Related bug could be reproduce without this line as described below: - Launch GUI_VisualStudio sample - Open 5 new documents - Drag Untitled6 to a new horizontal tabgroup - Open 4 more documents in that new group - Select Untitled9 - Select Untitled4 - Click on close button of Untitled9 - Now Untitled8 (tab) is selected, but view is Untitled10 - after clicking in the bottom view tab Untitled10 gets selected ok Regards, Oleksandr Lebed
|
|
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 |