AcMapSessionOptionsReactor class

Land Desktop Development ARX CPP SDK

 

AcMapSessionOptionsReactor class

Header file: MapReactors.h.

The AcMapSessionOptionsReactor class is used to represent a session options reactor, which notifies an application when a session option is modified.

To create a specific project options reactor, subclass from AcMapSessionOptionsReactor.

Use AcMapSession::AddOptionsReactor to add an options reactor to a session and AcMapSession::RemoveOptionsReactor to remove it.

You use the new operator to get an AcMySessionOptionsReactor pointer, and call AcMapSession::RemoveOptionsReactor to deallocate memory, as shown in the following example. For simplicity, routine error checking is not shown.

class AcMySessionOptionsReactor : public AcMapSessionOptionsReactor
{
   // See MapDemoApp.cpp distributed with AutoCAD Map ObjectARX. 
};
 
static AcMySessionOptionsReactor *pSysOptReactor ;

AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void *appId)
{
   AcMapSession   *mapApi = NULL; 
   switch (msg)  
   { 
   case AcRx::kInitAppMsg: 
      acrxRegisterAppMDIAware(appId); 
      //register commands -- code not shown 
      pSysOptReactor = new AcMySessionOptionsReactor (); 
      mapApi = AcMapGetSession(); 
      if (mapApi) 
         mapApi->AddOptionsReactor(pSysOptReactor) ; 
      break ; 
   case AcRx::kUnloadAppMsg: 
      //remove commands -- code not shown 
      break ; 
   case AcRx::kUnloadDwgMsg: 
      mapApi = AcMapGetSession(); 
         if (mapApi) 
         { 
            AcMapProject *pProj ; 
            if (mapApi->GetProject(pProj)) 
            mapApi->RemoveOptionsReactor(pSysOptReactor) ; 
          } 
          break ; 
   } 
   return AcRx::kRetOK; 
}