Print Page | Close Window

Pane & CXTFlatTabCtrl

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=1691
Printed Date: 01 July 2025 at 8:11pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Pane & CXTFlatTabCtrl
Posted By: jimmy
Subject: Pane & CXTFlatTabCtrl
Date Posted: 21 January 2005 at 6:47am
What is the simples way to put a CXTFlatTabCtrl with some Controls to a Pane.
Now i've a CWnd Containerand with this functions

class CTabbedPane : public CWnd
{
    CXTFlatTabCtrl  *m_pFlatTabCtrl;
    ....
};

// CTabbedPane message handlers
int CTabbedPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (__super::OnCreate(lpCreateStruct) == -1)
        return -1;

    m_pFlatTabCtrl = new CExFlatTabCtrl;
    m_pFlatTabCtrl->SetFocusOnSetCurSel();
    m_dwTabStyle = FTS_XT_BOTTOM | FTS_XT_HASARROWS | FTS_XT_HSCROLL | FTS_XT_TOOLTIPS;
    // Create  the flat tab control.
    GetClientRect(m_rcTabs);
    if (!m_pFlatTabCtrl->Create(WS_CHILD|WS_VISIBLE|m_dwTabStyle , m_rcTabs, this, IDC_TABCONTROL))
        {
        TRACE0( "Failed to create flattab control\n" );
        return -1;
        }

    OnCreateChilds();

    // Set the active view to the second tab.
    m_pFlatTabCtrl->SetCurSel(0);

    m_pFlatTabCtrl->SetWindowPos(&wndTop, 0, 0, 0, 0,
        SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);

    SetRedraw(TRUE);

    RedrawWindow(0,0, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN);

    OnCreateComplete();

    return 0;
    }

void CTabbedPane::AddItem(DWORD dwId, LPCTSTR lpText, CWnd *pWnd)
    {
    m_pFlatTabCtrl->InsertItem(dwId, lpText, pWnd);
    pWnd->SetWindowText(lpText);
    m_WndList.push_back(pWnd);
    }

void CTabbedPane::OnSize(UINT nType, int cx, int cy)
    {
    __super::OnSize(nType, cx, cy);
    if (m_pFlatTabCtrl && ::IsWindow(m_pFlatTabCtrl->m_hWnd))
        {
        m_pFlatTabCtrl->SetWindowPos(NULL, 0,0,cx,cy, SWP_FRAMECHANGED);
        }
    }

void CTabbedPane::OnSetFocus(CWnd* pOldWnd)
    {
    int iIndex = m_pFlatTabCtrl->GetCurSel();
    if (iIndex >= 0)
        {
        CWnd *pWnd = m_pFlatTabCtrl->GetItemWindow(iIndex);
        if (pWnd)
            pWnd->SetFocus();
        }
    }

Now i've one problem with this.
i create this window with Size CRect(0,0,10,10), because i  don't know the Pane size.
I've 2 CTabbedPane Control in 2 panes.
Pane 1 is visible, Pane 2 is not visible.
Now i select a Tab from Pane2.
GetPane2().GetFlatTabCtrl().SetCurSel( 3 );
If i make now Pane 2 visible. Tab Button's& Tabs are not visible, because
some internal varibales, m_xGripperPos, m_nOffset have a negative value (-300).
Now i Create my window with CRect(0,0,600,100) and it work, but
i think this is a bug. OnShowWindow from CXtFlatTabCtrl it must be do new calc
(same as in OnSize i think ).

    Jimmy




Replies:
Posted By: jimmy
Date Posted: 21 January 2005 at 8:02am
Hello,

Here is a sample (from MSDI)
Reproduce.
Start EXE. Look Pane1 Ok, Look Pane2 ok.
After Pane2 is visible, close App (PaneLayout will be saved)
Start EXE. Pane2 is visible. Now Select Menu 'Test' 'Select Pane1 Tab2'.
Now look into Pane1 and what do you see ?

uploads/jimmy/2005-01-21_080001_Bug_FlatTabCtrl.zip - 2005-01-21_080001_Bug_FlatTabCtrl.zip



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