Print Page | Close Window

CXTPTabControl is not painting its tab

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=5267
Printed Date: 11 November 2025 at 11:29am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPTabControl is not painting its tab
Posted By: pilhokim
Subject: CXTPTabControl is not painting its tab
Date Posted: 11 October 2006 at 1:28pm
Hello. I bought the Codejock Professional package two months ago and so I am a obvious novice on this package.

Q1. I am designing a kind of complex user interface which its view is derived from CXTTabView and within one of its tab (CWnd-derived control), I create CXTPTabControl to put more sub tabs. The problem is that I can see the tabs of CXTTabView clearly but the tab of CXTPTabControl created in one of CXTTabView tabs is not visible or clickable at all.

== My codes ==
/// test.h
    CXTPTabControl  m_wndTabControl;
  
/// test.cpp - OnCreate function
m_wndTabControl.Create(WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_TABSTOP, CRect(0, 0, 0, 0), this, IDC_MODEL_DATAVIEW_CONTROL);
    m_wndTabControl.GetPaintManager()->SetAppearance(xtpTabAppearanceStateButtons);
    m_wndTabControl.GetPaintManager()->SetPosition(xtpTabPositionBottom);
=====

Q2. While I was trying to solve this problem, I found one interesting thing in the example in the package source, TabManager_vc60. In PropertiesDialog.cpp, if you delete the line from 106 to 108 (see below), then the property dialog should show two tabs, but it does not paint the tabs and child controls correctly. I am wondering whether this is related with my problem or not.

== Removed lines ==
    m_wndTabControl.InsertItem(2, _T("DockingPane"), m_pageDockingPane, 0);
    m_wndTabControl.InsertItem(3, _T("AutoHidePanel"), m_pagePanel, 0);
    m_wndTabControl.InsertItem(4, _T("Margins"), m_pageMargins, 0);
====

The screen capture of Q2 is here. In this case, all children windows of each item are overlapped and displayed here and there at the same time. You can see this problem when you move mouse on over this dialog.





Replies:
Posted By: rmercer
Date Posted: 11 October 2006 at 3:41pm
Originally posted by pilhokim pilhokim wrote:

Hello. I bought the Codejock Professional package two months ago and so I am a obvious novice on this package.

Q1. I am designing a kind of complex user interface which its view is derived from CXTTabView and within one of its tab (CWnd-derived control), I create CXTPTabControl to put more sub tabs. The problem is that I can see the tabs of CXTTabView clearly but the tab of CXTPTabControl created in one of CXTTabView tabs is not visible or clickable at all.

== My codes ==
/// test.h
    CXTPTabControl  m_wndTabControl;
  
/// test.cpp - OnCreate function
m_wndTabControl.Create(WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_TABSTOP, CRect(0, 0, 0, 0), this, IDC_MODEL_DATAVIEW_CONTROL);
    m_wndTabControl.GetPaintManager()->SetAppearance(xtpTabAppearanceStateButtons);
    m_wndTabControl.GetPaintManager()->SetPosition(xtpTabPositionBottom);
=====

====
I'm not totally certain what you're trying to accomplish, but aren't you missing the WS_CHILD style from your create?
 
Here's an example from one of my applications that works:
 
m_wndTabControl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, CRect(0, 0, 0, 0), this, IDC_TABCONTROL);
 
Also, you've got a mesage handler for WM_SIZE and are resizing the control when the window is resized, correct?


Posted By: pilhokim
Date Posted: 12 October 2006 at 7:52pm
Thank you for the answer. I modified the code as advised -- putting WS_CHILD, but can see no changes. CXTPReportControl is still not painting its tabs. In my case, two controls ( first CXTPReportControl and CXTPPropertyGrid after) are inserted into m_wndToolBar and the report control is shown correctly at where it should be displayed. The only problem is the tab control failing in printing its tabs.

Yes, I process WM_SIZE message as shown below:

void CMyDataController::OnSize(UINT nType, int cx, int cy)
{
    CWnd::OnSize(nType, cx, cy);

    int nTop = 0;

    if (m_wndToolBar.GetSafeHwnd())
    {
        CSize sz = m_wndToolBar.CalcDockingLayout(cx, /*LM_HIDEWRAP|*/ LM_HORZDOCK|LM_HORZ | LM_COMMIT);

        m_wndToolBar.MoveWindow(0, nTop, cx, sz.cy);
        m_wndToolBar.Invalidate(FALSE);
        nTop += sz.cy;
    }
    if (m_wndTabControl.GetSafeHwnd())
    {
        m_wndTabControl.MoveWindow(0, nTop, cx, cy - nTop);
        m_wndTabControl.Invalidate(FALSE);

        CXTPClientRect rc(m_wndTabControl);
        m_wndTabControl.AdjustRect(FALSE, CRect(0, nTop, cx, cy-nTop));
        m_szClientRect = rc.Size();
    }
}

I captured this problem as shown in the below image. You can see the inner ReportControl is displayed well but the tabs of CXTPReportControl in my case supposed to display its tabs at bottom is not drawn at all. But only the space to display the tab is reserved.

Any advice will be very appreciated. This problem has put my development on hold for two days now.






Posted By: rmercer
Date Posted: 13 October 2006 at 10:39am
Originally posted by pilhokim pilhokim wrote:

I captured this problem as shown in the below image. You can see the inner ReportControl is displayed well but the tabs of CXTPReportControl in my case supposed to display its tabs at bottom is not drawn at all. But only the space to display the tab is reserved.

Any advice will be very appreciated. This problem has put my development on hold for two days now.
I can't see any issue with what you've posted, so perhaps someone else can assist.  I'm assuming you've added tabs (InsertItem) to the control.  If not, you won't see any tabs...
 
The only suggestions I would have are:
 
Try changing the position to xtpTabPositionTop, just to see what happens.
 
Try reducing the height of the m_wndToolBar to so you can see more of the wndTabControl, which may give you a better idea of what's going on...  If you still don't see the tab control then perhaps the control didn't get created for whatever reason...


Posted By: pilhokim
Date Posted: 13 October 2006 at 2:40pm
Thank you for you answer even if you are not a Codejock developer. Are you?
 
Yes. I already tried to change the position of tabs as you told but it did not work. Also, in fact my screen capture is not showing the toolbar. I did experiment in many ways and one of them is as you told removing the toolbar to see whether it affects tab displaying, but it had nothing related with the problem.
 
As I mentioned in the previous post, the control is created well based on my debugging result. All windows handles are assigned correctly and filled up with looking good memory addresses. Also the screen capture shows that the space to display the tabs are already assigned. Yes, I inserted items and the report control showin on the picture is the one that I put in to the tab control. Is it possible that I can see the inserted item of the tab control even if the tab control is not created well? The other proof is that I first create the tab control in zero size but later changed it to fit the client window. It also works well. Now the only problem left is tab drawing problem. If you think that I am understanding something wrong, please let me know.
 
This problem holds me  up too long and I am running out of time. I wish Codejock at least to check my Q2 question at the first post. That must be a BUG. I frankly want to be assured whether this UI is stable enough for my cases. For a while, I would rather come up with a different UI design.


Posted By: rmercer
Date Posted: 13 October 2006 at 3:15pm
Originally posted by pilhokim pilhokim wrote:

Thank you for you answer even if you are not a Codejock developer. Are you?
..snip..
This problem holds me  up too long and I am running out of time. I wish Codejock at least to check my Q2 question at the first post. That must be a BUG. I frankly want to be assured whether this UI is stable enough for my cases. For a while, I would rather come up with a different UI design.
Sorry, I do not work for Codejock.  We'll have to wait for them to assist you with your issue.
 
If it helps to reassure you, I use Codejock's libraries (including the tab control) in several commercial applications with zero problems. 
 
I've only experienced a few bugs, and all were minor.  They usually resolve issues very quickly if you use their support form.
 
Good luck.
 


Posted By: pilhokim
Date Posted: 16 October 2006 at 12:52pm
OK. The problem is solved. It was my stupid mistake. The answer is that  the WS_VISIBLE mask is missed when I create m_wndTabControl. I borrowed this code from TabManager_vc60 and in there m_wndTabControl is the child window in the dialog template in which we specify the WS_VISIBLE flag not in the code but in the dialog editor!! However, I am creating the TabControl dynamically in my application and I missed that difference.

Thank you CodeJock! As rmercer said above, they replied very quickly when I use their support forum.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net