Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - A bug of CXTPTabControl?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

A bug of CXTPTabControl?

 Post Reply Post Reply
Author
Message
zhou_wz View Drop Down
Groupie
Groupie


Joined: 11 December 2003
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote zhou_wz Quote  Post ReplyReply Direct Link To This Post Topic: A bug of CXTPTabControl?
    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?

Back to Top
zhou_wz View Drop Down
Groupie
Groupie


Joined: 11 December 2003
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote zhou_wz Quote  Post ReplyReply Direct Link To This Post 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()?
Back to Top
zhou_wz View Drop Down
Groupie
Groupie


Joined: 11 December 2003
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote zhou_wz Quote  Post ReplyReply Direct Link To This Post 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?

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: 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
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.031 seconds.