[gme-users] Add-on: How to close model editor window

Dan Simkins dan.simkins at workflow-science.com
Thu Mar 17 03:36:17 CDT 2011


Hi All,

I have a meta mode which has a "Model" of name "Composite". If I add a 
Composite node to my canvas, and double-click, the editor window would 
normally open up. I want to prevent this behaviour and have a custom 
form open instead (it is the double-click event that I am after, but 
this does not seem to be available to a BON add-on). So, my thought was 
to intercept the OBJEVENT_OPENMODEL event for the given kind, and then 
close the editor window and render a custom form. HOWEVER, I do not seem 
to be able to close the model editor window - please see code below.

Any pointers would be really appreciated,

Regards

Dan


void Component::objectEventPerformed( Object& object, unsigned long 
event, VARIANT v )
{

     object->getProject()->setAutoCommit( false ) ;

     try
     {
         std::string kind = object->getObjectMeta().name() ;

         if ( kind == "Composite" )
         {
             if ( event & OBJEVENT_OPENMODEL )
             {
                 BON::Model thisComp = object ;
thisComp->getModelI()->Close() ;    /*** THIS DOES NOT CLOSE EDITOR 
WINDOW ***/
             }
         }
     }
     catch ( BON::Exception e )
     {
         AfxMessageBox ( "BON::Exception: " + CString( 
e.getErrorMessage().c_str() ) ) ;
     }
     catch ( MON::Exception e )
     {
         AfxMessageBox ( "MON::Exception: " + CString( 
e.getErrorMessage().c_str() ) ) ;
     }
     catch ( ... )
     {
         AfxMessageBox ( "Exception: Unknown" ) ;
     }
}






More information about the gme-users mailing list