The commandStarting event fires when a request for a command to be executed has been received but before the command is executed. Through this event, it's possible to cancel the command from being executed.
-------- Import ----------------- Global variables --------- -------- Connect the handler to the event. --------- "userInterface_var" is a variable referencing a UserInterface object. -------- Event handler function definition --------- |
-------- Global variables ----------------- Connect the handler to the event. --------- "userInterface_var" is a variable referencing a UserInterface object. "MyCommandStartingHandler" is the name of the class that handles the event. -------- Event handler class definition --------- |
--------- Required include files. ------------------ Event handler class definition and global declaration. --------- class MyCommandStartingEventHandler : public adsk::core::ApplicationCommandEventHandler { public: void notify(const Ptr<ApplicationCommandEventArgs>& eventArgs) override { // Code to react to the event. ui->messageBox("In MyCommandStartingEventHandler event handler."); } } _commandStarting; --------- Connect the handler to the event. --------- |
-------- Event handler function definition ----------------- Connect the handler to the event. --------- "MyCommandStartingHandler" is the name of the class that handles the event. "userInterface_var" is a variable referencing a UserInterface object. |