Print Page | Close Window

In CXTTabCtrl, How to Show (or) Hide a view

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=13742
Printed Date: 08 May 2024 at 4:35am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: In CXTTabCtrl, How to Show (or) Hide a view
Posted By: A_K_N
Subject: In CXTTabCtrl, How to Show (or) Hide a view
Date Posted: 20 March 2009 at 1:32am
I have a CXTTabCtrl. I have added two views to it.

m_xtTabs.AddView( "Pane 1", RUNTIME_CLASS(CProjectBrowserView), NULL, NULL, ID_PROJECT_BROWSER_VIEW, -1 );
m_xtTabs.AddView( "Pane 2", RUNTIME_CLASS(CActivityView), NULL, NULL, ID_ACTIVITY_VIEW, -1 );

Two views got added & it's also visible.
I want to hide (or) show a view on click of a button.

How can I do that?


-------------
Thanks,
AKN



Replies:
Posted By: Oleg
Date Posted: 20 March 2009 at 6:05am
Hello,
 
You can remove it - DeleteView


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: A_K_N
Date Posted: 20 March 2009 at 6:12am
Also please suggest is there a way to disable a view in CXTTabCtrl.

-------------
Thanks,
AKN


Posted By: A_K_N
Date Posted: 20 March 2009 at 6:35am
I thought to have it as the last option. (DeleteView)

CMFCTabCtrl has the way to Show (or) Hide a Tab using ShowTab(...) function.
(By this way, I don't have to delete and recreate it again & again.)

The problem in that is I'm unable to add views to it succesfully.

CMFCTabCtrl has only AddTab function. So we need to create a view & add it.

m_ProjectBrowserView.Create( NULL, "Pane 1", dwStyle, rectDummy, m_wndTabs, ID_PROJECT_BROWSER_VIEW);
m_CurrentActivityView.Create( NULL, "Pane 2", dwStyle, rectDummy, m_wndTabs, ID_CURR_ACTIVITY_VIEW);
m_wndTabs.AddTab(&m_ProjectBrowserView, csBrowserView, (UINT)0);
m_wndTabs.AddTab(&m_CurrentActivityView, csActivityView, (UINT)1); 
              

But this crashes while closing. It's finding some problem during destroy window.
But adding view in CXTTablCtrl is possible using AddView function.
Also we are able to add view using RUNTIME_CLASS macro. Views creates using this way, doesn't find any problem.

m_wndTabs.AddView( "Pane 1", RUNTIME_CLASS(CProjectBrowserView), NULL, NULL, ID_PROJECT_BROWSER_VIEW, -1 );
m_wndTabs.AddView( "Pane 2", RUNTIME_CLASS(CActivityView), NULL, NULL, ID_CURR_ACTIVITY_VIEW, -1 );


Now during closing of window, it's not crashing.
That's why I'm looking towards using CXTTabCtrl for my application.

Ideally it will good to have a Show (or) Hide a view in CXTTabCtrl as done in CMFCTabCtrl.

-------------
Thanks,
AKN


Posted By: A_K_N
Date Posted: 21 March 2009 at 6:14am
Hi Oleg,

Can you suggest me any other control that can fit in to my requirement


-------------
Thanks,
AKN


Posted By: Oleg
Date Posted: 23 March 2009 at 1:54am
Hi,
 
You can try CXTPTabControl - it has option to show/hide tab but has not AddView - So copy thi s part from our sources.


-------------
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