![]() |
Tab trouble |
Post Reply
|
| Author | |
ContactGT
Newbie
Joined: 30 October 2006 Status: Offline Points: 28 |
Post Options
Thanks(0)
Quote Reply
Topic: Tab troublePosted: 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. |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
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 |