Print Page | Close Window

Tab trouble

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=5454
Printed Date: 11 November 2025 at 4:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Tab trouble
Posted By: ContactGT
Subject: Tab trouble
Date 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.



Replies:
Posted By: Oleg
Date 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



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