Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to Add Close Button to CXTPTabControl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to Add Close Button to CXTPTabControl

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


Joined: 25 November 2005
Location: Colombia
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote qinzhw Quote  Post ReplyReply Direct Link To This Post Topic: How to Add Close Button to CXTPTabControl
    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

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: 26 November 2005 at 6:31am

try

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

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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: 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
Back to Top
qinzhw View Drop Down
Newbie
Newbie


Joined: 25 November 2005
Location: Colombia
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote qinzhw Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
qinzhw View Drop Down
Newbie
Newbie


Joined: 25 November 2005
Location: Colombia
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote qinzhw Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2005 at 9:17am
sorry, the error occurs at the time I am closing all the tab view in a view.
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: 27 November 2005 at 4:02am
I need call stack. May be it is something in your sources.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
qinzhw View Drop Down
Newbie
Newbie


Joined: 25 November 2005
Location: Colombia
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote qinzhw Quote  Post ReplyReply Direct Link To This Post 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?

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: 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
Back to Top
qinzhw View Drop Down
Newbie
Newbie


Joined: 25 November 2005
Location: Colombia
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote qinzhw Quote  Post ReplyReply Direct Link To This Post Posted: 28 November 2005 at 6:51am
thx!!!!!!!!!!!!!!!
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.047 seconds.