Print Page | Close Window

How to Add Close Button to CXTPTabControl

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=3285
Printed Date: 09 November 2025 at 12:59pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to Add Close Button to CXTPTabControl
Posted By: qinzhw
Subject: How to Add Close Button to CXTPTabControl
Date Posted: 26 November 2005 at 12:20am

I want to devlop an application like the sample of Samples\Common\TabbedView, the views I want to add to the CXTPTabControl are derived from CHtmlView and CFormView, and I want to add or delete tab view dynamically, so I want to display a 'Close' Button or something else for user to close the active tab view, how can I do ? my XT is 9.6

thank you very much if you can answer my question




Replies:
Posted By: Oleg
Date Posted: 26 November 2005 at 6:31am

try

m_wndTabControl.FindNavigateButton(xtpTabNavigateButtonClose )->SetFlags(xtpTabNavigateButtonAlways);



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


Posted By: Oleg
Date Posted: 26 November 2005 at 6:32am

ps. not sure but may be "xtpTabNavigateButtonClose" in 9.6  called as

XTP_TABMANAGER_BUTTON_CLOSE



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


Posted By: qinzhw
Date Posted: 26 November 2005 at 9:15am

,thank you very much,oleg, it did work,but when application exited, I got a dialog showing:

Unhandled exception at 0x00856626 (XTP9601Libd.dll) in TabCtrlTest.exe: 0xC0000005: Access violation reading location 0x00000038.



Posted By: qinzhw
Date Posted: 26 November 2005 at 9:17am
sorry, the error occurs at the time I am closing all the tab view in a view.


Posted By: Oleg
Date Posted: 27 November 2005 at 4:02am
I need call stack. May be it is something in your sources.

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


Posted By: qinzhw
Date Posted: 27 November 2005 at 7:39am

my sources are including a lot of chinese characters, I don't know if you can read them normally, and I found this problem exists when I add a line as follows :

 m_wndTabControl.FindNavigateButton(xtpTabNavigateButtonClose )->SetFlags(xtpTabNavigateButtonAlways);

in the end of the CTabbedViewView::OnCreate(LPCREATESTRUCT lpCreateStruct) function in TabbedView Examples.

shall I write a line as

 m_wndTabControl.FindNavigateButton(xtpTabNavigateButtonClose )->SetFlags(xtpTabNavigateButtonNone);

before I close all the tabItems?



Posted By: Oleg
Date Posted: 28 November 2005 at 2:47am

ic.

Problem that you copied code from our sample that don't  check that

GetSelectedItem() can be NULL because it have no ability to close views.

 

You must add these checks.

F.e.

1. in void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)

add if (pView && pView->m_wndTabControl.GetSelectedItem())

2. in CTabbedViewView::OnSelectedChanged

add

 

 if (m_wndTabControl.GetSelectedItem())
 {
  CView* pView = DYNAMIC_DOWNCAST(CView, CWnd::FromHandle(m_wndTabControl.GetSelectedItem()->GetHa ndle()));
  ASSERT_KINDOF(CView, pView);

  pFrame->SetActiveView(pView);
 }
 else
 {
  pFrame->SetActiveView(this);
 }



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


Posted By: qinzhw
Date Posted: 28 November 2005 at 6:51am
thx!!!!!!!!!!!!!!!



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