![]() |
Pane & CXTFlatTabCtrl |
Post Reply ![]() |
Author | |
jimmy ![]() Senior Member ![]() Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
jimmy ![]() Senior Member ![]() Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
![]() ![]() ![]() ![]() ![]() |
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 ? 2005-01-21_080001_Bug_FlatTabCtrl.zip |
|
![]() |
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 |