SDI and Tab Manager |
Post Reply |
Author | |
naggerman
Newbie Joined: 21 January 2004 Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 26 April 2004 at 3:26pm |
Hi, I think this question was already posted before, and it was told to wait for 8.70. If I have multiple views to a single document in an SDI application and want to use tabs to switch between these views. How do I do that with the new tab manager? Thanks! Henrik
|
|
ipaqlinux48
Newbie Joined: 31 March 2004 Location: Belgium Status: Offline Points: 16 |
Post Options
Thanks(0)
|
In version 8.70, there is a new control: CXTPTabControl. I've also an SDI application which uses multiple views of the same document. However, this control doesn't send notification messages to the parent window (e.g. when the user closes a tab, switches to another tab, etc...). Maybe, version 8.71 ?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
You can inherit CXTPTabControl and inherit OnNavigateButtonClick and SetSelectedItem methods.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
ddyer
Groupie Joined: 01 December 2003 Location: United States Status: Offline Points: 40 |
Post Options
Thanks(0)
|
Oleg, In the TabManager sample is something called CXTPTabClientWnd. Is there a way to use this in an SDI application (have each view (tab client) point to the same document)? Im probably way off, but what if CMyAppView (the generated view class) acted as a placeholder who's only job in life is to provide its window to one of its member variables that is a CXTPTabClientWnd. Then when I want to create a new view as a tab client, I ask my host view's CXTPTabClientWnd to do so. I wanted to ask first because the docs for TabClientWnd are sparse and mention MDI a lot. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
CXTPTabClientWnd can be used only for MDI frame.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
ddyer
Groupie Joined: 01 December 2003 Location: United States Status: Offline Points: 40 |
Post Options
Thanks(0)
|
How would one then use CXTPTabControl to manage views? I have a simple generated CView from an SDI app and it has one member variable, m_tabCtrl (an XTPTabControl). I call m_tabCtrl's Create in the view's OnCreate method. The OnCreate, AddATab and CreateView methods shown below try to add one of my app's views to the tabCtrl. Regards, //////////////////////////////////////////////////////////// ////////////// { if (CView::OnCreate(lpCreateStruct) == -1) return -1; if (m_tabCtrl.Create(NULL, NULL, 0, CRect(0,0,0,0), this, 0, NULL) == FALSE) return -1; return 0; } //////////////////////////////////////////////////////////// ////////////// void CMyMainView::AddATab(void) { frame = CreateView(RUNTIME_CLASS(CMyApplicationView), GetDocument()); CXTPTabManagerItem *mi = m_tabCtrl.InsertItem(m_tabCtrl.GetItemCount(), title, frame->GetSafeHwnd(), 0); frame->SendMessage(WM_INITIALUPDATE); m_tabCtrl.SetSelectedItem(mi); } //////////////////////////////////////////////////////////// ////////////// { CFrameWnd *pFrame = new CFrameWnd; CCreateContext context; ::ZeroMemory(&context, sizeof(context)); context.m_pNewViewClass = type; context.m_pCurrentDoc = doc; context.m_pCurrentFrame = m_tabCtrl.GetParentFrame(); pFrame->Create(NULL, NULL, if (pFrame->GetSafeHwnd()) { |
|
ipaqlinux48
Newbie Joined: 31 March 2004 Location: Belgium Status: Offline Points: 16 |
Post Options
Thanks(0)
|
You forget the OnSize message handler. You should have something like this so that m_tabCtrl occupies the complete parent window: // Resize the list control contained in the view to I hope this solves your problem. Oh by the way, just remove the WS_CLIPCHILDREN window style for your view. Otherwise the screen will flicker as soon as your view is resized. |
|
naggerman
Newbie Joined: 21 January 2004 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Hi Doug, I tried your code, too. It works after adding the OnSize handling and adding WS_VISIBLE and WS_CHILD flags to the m_tabCtrl.Create. Your code was creating an invisible tab control. Regards, Henrik |
|
ddyer
Groupie Joined: 01 December 2003 Location: United States Status: Offline Points: 40 |
Post Options
Thanks(0)
|
LOL thanks guys... sometimes you can't see the forest for the trees. Hey, maybe I WANTED an invisible tab, ever think of that? Also, my onsize method was calling tabCtrl.OnSize() rather than the much more obvious MoveWindow. Thanks! BTW, if you replace CMyApplicationView with a CXTListView for the sake of discussion, and assume you have a few tabs created, anyone notice the listview flickers like mad whenever the tabs are clicked or the window is resized? The tabs themselves do not flicker, so I don't think its the creation of the tabCtrl member. How do you get rid of this flickering? Thanks |
|
ipaqlinux48
Newbie Joined: 31 March 2004 Location: Belgium Status: Offline Points: 16 |
Post Options
Thanks(0)
|
Use the WS_CLIPCHILDREN window style for your tab control. |
|
ddyer
Groupie Joined: 01 December 2003 Location: United States Status: Offline Points: 40 |
Post Options
Thanks(0)
|
Thanks! This tabcontrol is significantly better than cxttabview.... users can drag-rearrange the tabs. Hopefully today Ill finish moving over all the features I had in my old cxttabview subclass. |
|
ddyer
Groupie Joined: 01 December 2003 Location: United States Status: Offline Points: 40 |
Post Options
Thanks(0)
|
Hey here is something that would be great if anyone is up to it: Using the existing CXTTabControl inside a basic CView (as shown above), anyone think they can bring to life the Tab Group features demonstrated by CXTPTabClientWnd and shown in the TabManager sample application? The group feature Im refering too is what allows you to create horizontal and vertical tab collections. To see it in vc++, open a few source files and right-mouse-click on one of their tabs to see "New Tab XXX Group"). To see it in the TabManager sample demo, create a few tabbed docs, then drag a tab to the center of the doc area... you should be presented with the New Tab XXX Group menu. It looks like there is a lot of maintenance code for this ready to go, its just a matter of taking the TabClientWnd class and replacing it with one that is more SDI-centric. |
|
Karnize
Newbie Joined: 20 October 2003 Location: Italy Status: Offline Points: 19 |
Post Options
Thanks(0)
|
Hello, CXTPTabControl looks great, but I have one question. Does it support multiline tabs or only singleline? I was not able to see it in samples. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Only singleline now. Maybe in th future we will add multiline mode too.
Edited by oleg |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
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 |