Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - CXTPTabManagerNavigateButton - Close not working
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPTabManagerNavigateButton - Close not working

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 927
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: CXTPTabManagerNavigateButton - Close not working
    Posted: 29 May 2025 at 11:10am
I'm trying to figure out an odd issue with the close CXTPTabManagerNavigateButton. We have MDI tabs and we add the close button to the tabs. Sometimes the user has to click the "x" twice to get the window to close.

This is happening only in the V24 CJ toolkit . Comparing V24 to the previous version I have found that there are many more calls to CXTPTabManagerNavigateButton::SetRect where the rectangle passed in is empty. One such case is when the user activates our app (any time the activate message comes in for whatever reason). In V24 hooking code kicks in when I click in one of our document views (or elsewhere or dismiss certain windows that result in that message being sent and processed). I am not seeing this in V23. The empty rect is set by RepostiontablControlEx. The code for that is the same in both versions but it appears this hooking code just keeps making the call in V24:

>    ToolkitPro2410vc170x64UD.dll!CXTPTabManagerNavigateButton::SetRect(CRect rcButton) Line 94    C++
     ToolkitPro2410vc170x64UD.dll!CXTPTabManagerItem::SetRect(CRect rcItem) Line 311    C++
     ToolkitPro2410vc170x64UD.dll!CXTPTabPaintManager::RepositionTabControlEx(CXTPTabManager * pTabManager, CDC * pDC, CRect rcClient) Line 1513    C++
     ToolkitPro2410vc170x64UD.dll!CXTPTabPaintManagerTheme::RepositionTabControl(CXTPTabManager * pTabManager, CDC * pDC, CRect rcClient) Line 411    C++
     ToolkitPro2410vc170x64UD.dll!CXTPTabPaintManager::RepositionTabControl(CXTPTabManager * pTabManager, CDC * pDC, CRect rcClient) Line 994    C++
     ToolkitPro2410vc170x64UD.dll!CXTPTabClientWnd::CalcWindowRect(tagRECT * lpClientRect, unsigned int nAdjustType) Line 1591    C++
     jengined.dll!JFrameWnd::RepositionBars(unsigned int nIDFirst, unsigned int nIDLast, unsigned int nIDLeftOver, unsigned int nFlags, tagRECT * lpRectParam, const tagRECT * lpRectClient, int bStretch) Line 15455    C++
     jengined.dll!JFrameWnd::RecalcLayout(int bNotify) Line 15761    C++
     ToolkitPro2410vc170x64UD.dll!CXTPCommandBars::RecalcFrameLayout(int bDelay) Line 426    C++
     ToolkitPro2410vc170x64UD.dll!CXTPCommandBars::RedrawCommandBars() Line 737    C++
     ToolkitPro2410vc170x64UD.dll!CXTPCommandBarsFrameHook::OnHookMessage(HWND__ * hWnd, unsigned int nMessage, unsigned __int64 & wParam, __int64 & lParam, __int64 & lResult) Line 1271    C++
     ToolkitPro2410vc170x64UD.dll!CXTPHookManager::CHookSink::OnHookMessage(HWND__ * hWnd, unsigned int nMessage, unsigned __int64 & wParam, __int64 & lParam, __int64 & lResult) Line 320    C++
     ToolkitPro2410vc170x64UD.dll!CXTPHookManager::HookWndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 443    C++


Then the rect is left empty until I click on the close item itself in which case a paint message arrives and the V24 code actually sets the rect so it isn't empty. So I click once and a ProcessClick method finds the rect is empty so the check to see if the point is in the rect fails and nothing happens. But a paint soon arrives and the rect is set. So the second click finds the point is in the rect and the window closes.

In V22 of CJ, I have an identical breakpoint set in SetRect that trips only if the rect is empty and that only appears to happen when I first open a document window and the tab control is created. Then the paint occurs and the rect is set and clicking "x" closes the file.

2025 - button is set to 0,0,0,0 only one time when I open the file and before the tab is drawn.

 

ToolkitPro2200vc170x64UD.dll!CXTPTabManagerNavigateButton::SetRect(CRect rcButton) Line 92        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabManagerItem::SetRect(CRect rcItem) Line 310        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabPaintManager::RepositionTabControlEx(CXTPTabManager * pTabManager, CDC * pDC, CRect rcClient) Line 1504        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabPaintManagerTheme::RepositionTabControl(CXTPTabManager * pTabManager, CDC * pDC, CRect rcClient) Line 410        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabPaintManager::RepositionTabControl(CXTPTabManager * pTabManager, CDC * pDC, CRect rcClient) Line 984        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabClientWnd::CalcWindowRect(tagRECT * lpClientRect, unsigned int nAdjustType) Line 1557        C++

         jengined.dll!JFrameWnd::RepositionBars(unsigned int nIDFirst, unsigned int nIDLast, unsigned int nIDLeftOver, unsigned int nFlags, tagRECT * lpRectParam, const tagRECT * lpRectClient, int bStretch) Line 14138        C++

         jengined.dll!JFrameWnd::RecalcLayout(int bNotify) Line 14447        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabClientWnd::Reposition() Line 2558        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabClientWnd::UpdateContents() Line 1364        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabClientWnd::OnIdleUpdateCmdUI() Line 1095        C++

         mfc140ud.dll!CWnd::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 2465        C++

>        mfc140ud.dll!CWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2100        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabClientWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2656        C++

         mfc140ud.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 265        C++

         mfc140ud.dll!CWnd::SendMessageToDescendants(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam, int bDeep, int bOnlyPerm) Line 3023        C++

         mfc140ud.dll!CWnd::SendMessageToDescendants(unsigned int message, unsigned __int64 wParam, __int64 lParam, int bDeep, int bOnlyPerm) Line 129        C++

         jengined.dll!JMFCAdapter::IJMainFrameWndImp::OnIdle(long nCount) Line 4037        C++

         jengined.dll!JApplication::UpdateToolBarButtons(int * pbInPlaceServer) Line 2134        C++

         jengined.dll!JApplication::OnIdle(IdleLoopData & idleLoopData) Line 1371        C++

         jengined.dll!ProcessIdleLoop(IdleLoopData & idleLoopData) Line 4399        C++

 

 

 

Then wm_paint comes thru and the rect is set:

 

         ToolkitPro2200vc170x64UD.dll!CXTPTabManagerNavigateButton::SetRect(CRect rcButton) Line 92        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabPaintManager::DrawSingleButtonIconAndText(CDC * pDC, CXTPTabManagerItem * pItem, CRect rcItem, int bDraw) Line 722        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabThemeVisualStudio2012::DrawSingleButton(CDC * pDC, CXTPTabManagerItem * pItem) Line 61        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabPaintManager::DrawRowItems(CXTPTabManager * pTabManager, CDC * pDC, const CRect & rcClipBox, int nItemRow) Line 493        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabPaintManager::DrawTabControlEx(CXTPTabManager * pTabManager, CDC * pDC, CRect rcClient) Line 547        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabPaintManagerTheme::DrawTabControl(CXTPTabManager * pTabManager, CDC * pDC, CRect rcControl) Line 404        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabPaintManager::DrawTabControl(CXTPTabManager * pTabManager, CDC * pDC, CRect rcClient) Line 420        C++

         ToolkitPro2200vc170x64UD.dll!CXTPTabClientWnd::CSingleWorkspace::OnPaint() Line 188        C++

         mfc140ud.dll!CWnd::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 2465        C++

>        ToolkitPro2200vc170x64UD.dll!CXTPTabClientWnd::CSingleWorkspace::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 76        C++


Essentially in V24 that same breakpoint that traps an empty is tripping a lot and even moving the mouse over the tab doesn't cause a paint which would set the correct rect.

So, bug in CJ V24? If so, what is the fix?
Back to Top
agontarenko View Drop Down
Admin Group
Admin Group


Joined: 25 March 2016
Status: Offline
Points: 317
Post Options Post Options   Thanks (0) Thanks(0)   Quote agontarenko Quote  Post ReplyReply Direct Link To This Post Posted: Yesterday at 3:42am
Hello,

How I can to reproduce this problem?

Regards,
Artem Gontarenko
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 927
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 20 hours 3 minutes ago at 9:11am
I didn't see any sample that put the close button on an mdi tab. But if you have one run it and then click activate another app and then move the mouse back to the mdi tab and click the x.

With V22 clicking the x not only activates the app but it closes the window. With V24 I have to click the x again to close the window.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 927
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 13 hours 26 minutes ago at 3:48pm
Hi Artem,

I am able to duplicate with the RibbonMDISample in V24.1. You can either modify the sample to call SetFlags( xtpWorkspaceShowCloseTab|xtpWorkspaceShowActiveFiles) on the XTPTabClientWnd member of the frame or just build the project and open XTPTabClientWnd.cpp and in the constructor on line 183 set a break point.

Then when the break point is reached, use the debugger to deposit 0x14 into m_dwFlags.

Then continue. when the sample comes up a mdi window is already opened and you should be able to see the close button on the tab. I go ahead and click activate the debugger so the ribbon sample is not activated. Then move the mouse over the X on the mdi tab and click it. Nothing happens. Click again to close the mdi window.

I also have noticed even in V22 that even if the app/sample is active, when you move over the x button it never highlights. I've never really cared about that since no customer has complained. I don't know how far back that goes. That's different than the workspace close button (I add the left/right nav buttons as well as close and the window dropdown on the far right). And its different than docking pane close buttons. All highlight when moving over them. Might be some paint manager setting for that which I have never bothered to find.

I'm sure if moving over the mdi tab close button caused a paint message to highlight it, the rect won't be empty and it would close. However, even in V22 that button doesn't highlight and clicking once closes the window and you can see on mouse down the state of the button changes and the display updates.

Thanks for such a quick response. Sorry I didn't get to the sample earlier and get it to show the close button.


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.078 seconds.