Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - SDI and Tab Manager
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SDI and Tab Manager

 Post Reply Post Reply
Author
Message
naggerman View Drop Down
Newbie
Newbie


Joined: 21 January 2004
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote naggerman Quote  Post ReplyReply Direct Link To This Post Topic: SDI and Tab Manager
    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

 

Back to Top
ipaqlinux48 View Drop Down
Newbie
Newbie
Avatar

Joined: 31 March 2004
Location: Belgium
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote ipaqlinux48 Quote  Post ReplyReply Direct Link To This Post Posted: 28 April 2004 at 12:51pm
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 ?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 29 April 2004 at 9:57am
You can inherit CXTPTabControl and inherit OnNavigateButtonClick and SetSelectedItem methods.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
ddyer View Drop Down
Groupie
Groupie
Avatar

Joined: 01 December 2003
Location: United States
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddyer Quote  Post ReplyReply Direct Link To This Post Posted: 29 April 2004 at 4:15pm

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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 30 April 2004 at 12:32am
CXTPTabClientWnd  can be used only for MDI frame.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
ddyer View Drop Down
Groupie
Groupie
Avatar

Joined: 01 December 2003
Location: United States
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddyer Quote  Post ReplyReply Direct Link To This Post Posted: 30 April 2004 at 11:02am

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.

Nothing seems to work right.  Im not sure if I need to do something with my view's OnSize or OnPaint or OnDraw, but I just can't get this to work.  I've tried various onsize, onpaint, ondraw tests but haven't gotten anywhere really. 

Oleg, I know you are a busy guy, but do you have any thoughts on this?

Regards,
Doug

//////////////////////////////////////////////////////////// //////////////
int CMyMainView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 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* CMyMainView::CreateView(CRuntimeClass *type, CDocument *doc)
{
 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,
 
WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, CRect(0, 0, 0, 0),
  &m_tabCtrl, NULL, 0, &context);

 if (pFrame->GetSafeHwnd()) {
  pFrame->ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
  pFrame->GetWindow(GW_CHILD)->ModifyStyleEx(WS_EX_CLIEN TEDGE, 0,  
  SWP_FRAMECHANGED);
 }

 pFrame->SetActiveView((CView*)pFrame->GetWindow( GW_CHILD));
 return pFrame;
}

Back to Top
ipaqlinux48 View Drop Down
Newbie
Newbie
Avatar

Joined: 31 March 2004
Location: Belgium
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote ipaqlinux48 Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2004 at 1:30am

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
// fill the entire view when the view's window is
// resized. CMyView is a CView derived class.
void CMyMainView::OnSize(UINT nType, int cx, int cy)
{
   CView::OnSize(nType, cx, cy);
   // Resize tab control to fill the whole view.
   m_tabCtrl.MoveWindow (0, 0, cx, cy);
}

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.

Back to Top
naggerman View Drop Down
Newbie
Newbie


Joined: 21 January 2004
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote naggerman Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2004 at 10:04am

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

Back to Top
ddyer View Drop Down
Groupie
Groupie
Avatar

Joined: 01 December 2003
Location: United States
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddyer Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2004 at 7:50am

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
Doug

Back to Top
ipaqlinux48 View Drop Down
Newbie
Newbie
Avatar

Joined: 31 March 2004
Location: Belgium
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote ipaqlinux48 Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2004 at 8:03am

Use the WS_CLIPCHILDREN window style for your tab control.

Back to Top
ddyer View Drop Down
Groupie
Groupie
Avatar

Joined: 01 December 2003
Location: United States
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddyer Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2004 at 8:14am

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.

Back to Top
ddyer View Drop Down
Groupie
Groupie
Avatar

Joined: 01 December 2003
Location: United States
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddyer Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2004 at 12:21pm

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. 

Back to Top
Karnize View Drop Down
Newbie
Newbie
Avatar

Joined: 20 October 2003
Location: Italy
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Karnize Quote  Post ReplyReply Direct Link To This Post Posted: 05 May 2004 at 2:33am

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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 05 May 2004 at 10:50am
Only singleline now. Maybe in th future we will add multiline mode too.

Edited by oleg
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.172 seconds.