Print Page | Close Window

IsValid, IsClosed, Handle

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=3827
Printed Date: 04 May 2024 at 4:25am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: IsValid, IsClosed, Handle
Posted By: Stratiotes
Subject: IsValid, IsClosed, Handle
Date Posted: 21 March 2006 at 3:55pm

I have a question about the suggested method to use in this case.

I had the following code to capture the current pane rectangle:

 CXTPDockingPane * pPane = m_paneManager.FindPane(IDR_MY_PANE);
 if( pPane != NULL && pPane->IsValid() )
 {
    CRect rectPane( pPane->GetPaneWindowRect() );

    // do something with rectPane
}

Now a problem came when the user clicked on the "x" to close the pane and then it came to this code - it throws an exception on the GetPaneWindowRect.   Which led me to wonder why it was not NULL and still valid even after being closed - is that intentional?

Second question, I thought it would be easy to fix by adding a pPane->GetSafeHwnd(); to the if-test but then the build failrue indicates that GetSafeHwnd is a protected member and cannot be called here.  So I looked thru the header file and found the  IsClosed() method and add a !pPane->IsClosed() to the test and that resolves the issue.   Is that the preferred method for handling this situation?

Thanks

 



-------------
Mark



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