Sub OnClose( _ ByVal Reason As System.Integer _ )
Dim instance As IPropertyManagerPage2Handler8 Dim Reason As System.Integer instance.OnClose(Reason)
void OnClose( System.int Reason )
void OnClose( & System.int Reason )
Reason this method is called as defined in swPropertyManagerPageCloseReasons_e
This handler method is called when the PropertyManager page is about to close.
SolidWorks controls when add-ins can do work. An add-in is unable to do any real work within the PropertyManager2Handler8::OnClose handler because the PropertyManager page and command are closing. So, typically the IPropertyPage2Handler8::AfterClose handler is called after IPropertyManager2Handler7::OnClose to allow an add-in to do work. However:
If PropertyManager page is...
And you implemented the handler in...
Then you...
Not pinned
C++
Can prevent the PropertyManager page from closing by setting the HRESULT return value to S_FALSE.
Visual Basic
Should use the Err.Raise method with a value of 1 to prevent the PropertyManager page from closing. In VB.NET, use 0 with Err.Raise.
NOTE: When control returns to SolidWorks:
The IPropertyManager page remains displayed on the screen.
The IPropertyManagerPage2Handler8::AfterClose handler is not called.
Pinned
C++ or Visual Basic
Set HRESULT to S_FALSE to close the PropertyManager page (i.e., ignore the fact that the page is pinned).
This allows your add-in to call the IPropertyManagerPage2Handler8::AfterClose handler and do its work. To avoid aggravating your user, who expected the PropertyManager page to remain pinned, you should re-display and re-pin the PropertyManager page after the add-in finishes its work.
To close a pinned PropertyManager page by raising an exception, your application has to clear all selections by calling IModelDoc2::ClearSelection2(true) in the call to IPropertyManagerPage2Handler8::OnClose. The PropertyManager page will not close if selections exist.
NOTE: In a previous version of this method, IPropertyManagerPage2Handler3::OnClose, if the user clicked the Cancel button and the PropertyManager page had a pushpin, then this method returned swPropertyManagerPageClose_Closed. This version of this method returns swPropertyManagerPageClose_Cancel in this scenario.
Managed code can indicate that a PropertyManager page cannot be closed. Throw a COM exception with an error code of 1. For example, in C#: void OnClose (int reason) { // Throw a COM exception as an indication the PropertyManager // page cannot be closed at this time: // The error code must be 1, which equates to S_FALSE. COMException ex = new COMException("Cannot close PropertyManager page", 1); throw ex; }
Provide feedback on this topic
SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.
* Required
Thank you for your comments. We will contact you if we have questions regarding your feedback.
Sincerely,The SOLIDWORKS Documentation Team
Print Topic
Select the scope of content to print:
We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.
Web Help Content Version: API Help (English only) 2013 SP05 To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help. To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.