SilverScreen Solid Modeler

A Note on Command IDs

A Note on Command IDs

Previous topic Next topic  

A Note on Command IDs

Previous topic Next topic JavaScript is required for the print function  

SilverPlusEllipse

 

A Note on Command IDs

 


In your SilverPlus DLL, when you are setting up command IDs for menu items, toolbar buttons and the like, the range ID_FIRST_DEVELOPER_ID through ID_LAST_DEVELOPER_ID (defined in silver.h) should be used. The reason for this is that SilverScreen and your DLL will share many command messages, and each must be able to determine whether to handle a command or let it flow through the architecture.

 

SilverScreen now has two ways of dealing with developer command IDs. In the first case (the default), SilverScreen will automatically inform MFC that there are handlers for these commands, and thus they will be enabled when you use them.

 

In the second case, SilverScreen can be told to pass the address of a CCmdUi object for the command ID down to the DLL, and the DLL can determine what is to be done. This behavior is conditioned on the CV variable CV_PASSTHRU_CMDUI_ENABLE. When set to TRUE, SilverScreen will, in its command UI handler for developer's ids, call SendMessage with a message value of WM_CMDUI_ENABLE, a wParam value of the command ID, and lParam is the address of the CCmdUi object passed to SilverScreen. This message may then be intercepted in your subclassing window function, and the CCmdUi pointer used to call Enable, SetCheck or othe member functions.

 

For example, in your initialization code, you would call:

 

C / C++ Code

 

  cv_set(CV_PASSTHRU_CMDUI_ENABLE, 1);

 

 

Then, in your mainframe subclassing code, you would add the something like following code, where get_command_enable_value is assumed to return true if the developer id parameter should be enabled:

 

C / C++ Code

 

switch ( message )

   {

   . . .

 

   case WM_CMDUI_ENABLE:                                 

         {

         int enable;

         

         CCmdUI *cmdui = (CCmdUI *) lParam;                                                                // obtain CCmdUi pointer

         enable = get_command_enable_value( wParam );

         cmdui->Enable( enable );

         }

      break;

 

   . . .

   }