Print Page | Close Window

A bug of 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=2612
Printed Date: 08 November 2025 at 4:03pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: A bug of CXTPTabControl?
Posted By: zhou_wz
Subject: A bug of CXTPTabControl?
Date Posted: 21 July 2005 at 7:44am

I add two editbox to CXTPTabControl!
When I use DeleteAllItems() to remove all editbox in CXTPTabControl.
There still editbox exist in tabcontrol.

I check the code and find the reason:
CXTPTabManagerItem does nothing for its m_hWnd in destructor.
That means, all window added to XTPTabControl must be destroyed manually.

So I add as below
CXTPTabManagerItem::~CXTPTabManagerItem()
{
 if(IsWindow(m_hWnd))
 {
  DestroyWindow(m_hWnd);
  m_hWnd = NULL;
 };
}
So that CXTPTabManager::DeleteItem() and DeleteAllItems() would destroy the child window as I need.

But another problem prompt:
I used a CXTPTabClientWnd
In function UpdateContents()
There is the line:
   pFoundItem->Remove();
When call this, the found CXTPTabManagerItem's window(i.e, childwindow) will be destroyed by  CXTPTabManager::DeleteItem();

While another line in UpdateContents() is :
   pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);
when the pChildWnd->m_hWnd is destroyed, this function would be turned into assert failure!

(That is, the last childframe of multidoc app is closing, you will catch the failure)

How can I solve this?




Replies:
Posted By: zhou_wz
Date Posted: 21 July 2005 at 8:17am
And could someone tell us why only the last child send the assert after my modification on CXTPTabManagerItem::~CXTPTabManagerItem()?


Posted By: zhou_wz
Date Posted: 21 July 2005 at 7:38pm

I reffer to CXTTabCtrl:
And find there is DeleteItem(nItem, BOOL bDestroyWnd);

So the better modification of CXTPTabContorl is the same like CXTTabCtrl?
Use the parameter bDestroyWnd to let user select to destory the window?



Posted By: Oleg
Date Posted: 21 July 2005 at 11:17pm

Don't modify CXTPTabManagerItem in same way.

CXTPTabControl have no idea do you want destroy or hide child panes if they closed so you must manually Destroy them. (There are a lot of situations when developer don't want to destroy them).

 



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