3D PLM Enterprise Architecture

User Interface - Commands

Creating a State Dialog Command

How to create the dialog command class
Technical Article

Abstract

This article is the state dialog command programmer's guide. Organized as a step-by-step, it deals with all you can do to program your state dialog command.


Creating the State Dialog Command Class Header

This shows how to create the class header file. Assume your class is named CAACommandCmd. The main to do is:

Once you have completed this step, the header file of your state dialog command class should look like this:

#include "CATStateCommand.h"

class CAACommandCmd : public CATStateCommand
{
  CmdDeclareResource(CAACommandCmd, CATStateCommand);
  public :
    CAACommandCmd();
    virtual ~CAACommandCmd();
    CATStatusChangeRC Activate   (CATCommand * iCmd, CATNotification * iNotif);
    CATStatusChangeRC Desactivate(CATCommand * iCmd, CATNotification * iNotif);
    CATStatusChangeRC Cancel     (CATCommand * iCmd, CATNotification * iNotif);

    virtual void BuildGraph();
    CATBoolean  GuardConditionMethod1(void * iUsefulData);
    CATBoolean  GuardConditionMethod2(void * iUsefulData); 
    CATBoolean  ActionMethod1(void * iUsefulData);
    CATBoolean  ActionMethod2(void * iUsefulData);

  private :
    CATDialogAgent      * _daAgent;
    CATIndicationAgent  * _daIndicationAgent;
    CATPathElementAgent * _daSelectionAgent;
};

It can include additional methods and data members, for example, to access the document objects your command can work on.

[Top]


In Short

A dialog state command is a dialog command designed as a state machine, each state enabling end user input, that enables the end user to pass from state to state using transitions between these states triggered when requested events happen and when requested guard conditions are satisfied, and that execute the declared actions. It is modeled using a class deriving from the CATStateCommand class.

The statechart diagram is implemented using the BuildGraph method, and the command life cycle is managed by the Activate, Desactivate, and Cancel methods in addition to the command class constructor and destructor.

[Top]


History

Version: 1 [Jan 2000] • Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.