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

Tab trouble

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


Joined: 30 October 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote ContactGT Quote  Post ReplyReply Direct Link To This Post Topic: Tab trouble
    Posted: 07 November 2006 at 12:22pm
I need help!. I am trying to do something, which I consider to be simple, but I'm really struggling to get it to work.
 
I have an MDI application, working with just 1 document (for now).
I have several different classes of CView - FlamingoGanttView and FlamingoNavigatorView for example.
I have menu items to let the user add and remove these views.
Each view should appear only once.
 
At the moment, my MainFrame derives from CXTPMDIFrameWnd and contains a CXTPTabClientWnd m_MTIClientWnd and I keep a pointer to each view once it is create. This allows me to tick the menu item to say the view is on the screen.
 
At the moment, I have this code in the method behind the menu item.
 
void CMainFrame::OnViewsGanttChart()
{
 if (m_viewGantt != NULL)
 {
  // Don't know how to close the window yet.
 }
 else
 {
  CMDIChildWnd* pActiveChild = MDIGetActive();
  CDocument* pDocument= pActiveChild->GetActiveDocument()) == NULL)
  CMultiDocTemplate docTemplate(IDR_GanttTYPE,
  RUNTIME_CLASS(CFlamingoDoc),
  RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  RUNTIME_CLASS(FlamingoGanttView));
  CChildFrame *newChild = (CChildFrame*) docTemplate.CreateNewFrame(pDocument, NULL);
  docTemplate.InitialUpdateFrame(newChild, pDocument);
  CCreateContext context;
  context.m_pCurrentFrame = newChild;
  context.m_pCurrentDoc = pDocument;
  context.m_pNewViewClass = RUNTIME_CLASS(FlamingoGanttView);
  context.m_pNewDocTemplate = &docTemplate;
  m_viewGantt = (FlamingoGanttView*) CreateView(&context, IDGT_VIEW_GANTT);
  SetActiveView(m_viewGantt, TRUE);
  m_viewGantt->ShowWindow(SW_SHOW);
  m_viewGantt->SetWindowText("Gantt Chart");
 }
}
 
My first question is, does this sound like the best way to implement a tabbed main area?
Second question - how do I change the name of the tab - they are both getting called "Navigator1". I would like "Navigator" and "Gantt Chart" at the tab names.
Third question - how do I close these views and tabs? I have a pointer to the view, but CloseWindow and DestroyWindow don't do anything.
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 08 November 2006 at 12:29am
 
1. Doesn't look like good code :(
 
 
2. TabClient sends WM_XTP_GETWINDOWTEXT to CChildFrame, catch it and return (LPCTSTR) to caption you need.
 
3. you have to close not view but its CChIldFrame parent - pView->GetParent()->CloseWindow();
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.063 seconds.