With The Case Of  Release The Power OF  Visual C++ !   Home Products | Purchase Support | Downloads  
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
VX++ Cross-Platform C/C++
ActiveX COM Products
Technical Support
  General Q & A
Discussion Board
Contact Us


Get Ready to Unleash the Power of UCanCode .NET

[ First | Prev | Next | Last ]

Introduction to Commands 

Command objects are a part of the undo/redo system in XD++. A command is an object that knows how to save and restore an event. When the end-user performs an action on a model, the application collects the information required to execute that action into a command. Then, the application executes the command (in other words, it performs the action) and then saves the executed command to a transaction model.

Each command has a different type ID. Type IDs can be used to distinguish one type of command from another when you have a pointer to a generic CFOAction object. There is a default ID for each class. For example, a move command has an ID of ACTION_MOVECOMPONENT. You can change this ID if you want to distinguish among commands of the same class.

Executing and Unexecuting

A command does not perform an action until its Execute() method is called. The command stores any additional information it might need to undo a command and then calls methods in the model to perform its action.

When a command is undone, its GetUndoAction() method is called. Stored information is retrieved from here and then the action is reversed. Some unexecute methods create a whole new command that performs the inverse action and then executes it.

Target Model

A command keeps a pointer to the model to which it pertains. It uses this pointer to get access to the methods that enable it to complete its action. For example, when a move command is executed, it calls the method MoveShape() in CFODataModel.

Shapes in a Command

Every command keeps a list of pointers to the shapes it affects. These shapes are reference counted, so they cannot be deleted from memory before all the commands are done using them. For example, if the user selected a component and deleted it, the component would still be referenced by the delete command even though it is no longer in the model. If the component was deleted when it was removed from the model, the command would have a bad pointer to it. If the user tried to undo the delete command, the program would crash. Because the components are reference counted, the component would remain in memory as long as the delete command was around.

Current XD++ support the following command. Each command support undo redo model. you can create your own command using XD++ ClassWizard.

Command Class Name


CFOBaseAction This is the base class of all the command objects in XD++,It monitors the model on which the command is executing. It also monitors a set of the CFODrawShape objects that it affects. Each command object has an ID associated with it so the code can distinguish among commands without using run-time type information..
CFOAddCompAction Use this command to insert a new shape into the model. When you execute this command, the component is added to the model. When you undo the action, a CFORemoveCompAction is created and executed.
CFOAddCompsAction Use this command to insert a list of new components into the model. When you execute this command, the components are added to the model. When you undo the action, a CFORemoveCompsAction is created and executed.
CFOAlignAction The alignment command aligns a list of components in relation to an anchor component. The anchor component is the last one in a set of components. There are six different ways to align a component: top, middle, bottom, left, center and right.

The alignment command comprises many different move commands, which is why it is derived from CFOActionMacro. Each component in the list of selected components has a corresponding move command that moves it by the proper offsets to align it with the anchor. When you undo the action, the negative offsets of the move commands are used.

CFOColorChangeAction Change the select component's back color and text color.
CFOFormColorChangeAction Change current form's back color and text color.
CFOFormSizeAndNameAction Change current form's caption and size.
CFOFormSizeAction Change current form's size.
CFOMoveCompAction The move command moves a component. This command enables the end-user to move the component.It applies a new offset to change the component's position. To undo the action, CFOMoveCompAction uses the negative of the offsets. 
CFOMoveCompsAction The move command moves a list of components. This command enables the end-user to move the components.It applies a new offset to change each component's position. To undo the action, CFOMoveCompsAction uses the negative of the offsets. 
CFOOrderAction The order command changes the z-order of a list of components. You can change the order in four ways: move the component back one, move the component forward one, move the component to the back, move the components to the front.

The original order of the components is saved and then the components are moved within the stacking order. When you undo the action, the original orders are retrieved from memory and the components are moved back to their original positions.

CFOOrderSingleAction Order a single component.
CFORemoveCompAction The Remove command removes a component from the model. When you execute this command, the component is removed from the model. When you undo the action, a CFOAddCompAction is created and executed.
CFORemoveCompsAction The Remove command removes a list of components from the model. When you execute this command, the components are removed from the model. When you undo the action, a CFOAddCompsAction is created and executed.
CFOScaleAction Scale componet.
CFOSizeAction The size command sets the size of one or more components. You can use the size command to set a component's width, height, or both.
CFOSpacingAction The spacing command allows you to evenly space a set of components horizontally, vertically, or both.
[ First | Prev | Next | Last ]

Ask any questions by MSN: Yahoo:


Copyright ?1998-2022 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to