Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Engineering

Undo/Redo Support for Callbacks

  • Last UpdatedOct 29, 2024
  • 2 minute read

AVEVA E3D Undo/Redo is supported by certain callback actions for FORM, MENU, and GADGET objects. Appware can decide, for any callback action, whether it is 'undoable', that is, supports the Undo/Redo buttons on the main toolbar. If so, then a AVEVA E3D UNDOABLE object must be created and populated with the required Undo and Redo action strings, and then assigned to the appropriate Forms and Menus (F&M) object callback.

For example:

In the form definition extract below:

Layout form !!myform . . .

Title |MyForm with undoable callbacks|

-- create form members as UNDOABLE objects for each F&M callback action,

-- which is to be undoable, e.g. form OK callback, gadget callbacks etc.

member !okUndo is UNDOABLE

member !doitUndo is UNDOABLE

. . .

button .doit |Do it| …

. . .

button .ok | OK | … OK

exit

define method .myform()

-- Constructor

. . .

-- Set up callbacks and assign any undo/redo actions to their undoable objects

!this.okCall = !this.formOK()

!this.okUndo.description( 'MyForm OKcall undo/redo actions' )

!this.okUndo.undoAction( ' ' )

!this.okUndo.redoAction( ' ' )

-- assign undoable to form OK callback

!this.setUndoable( 'OKcall', !okUndo )

--

!this.doit.callback = '!this.gadgetActions('

!this.doitUndo.description( 'MyForm doit button undo/redo actions' )

!this.doitUndo.undoAction( '!this.undoitAction( )' )

!this.doitUndo.redoAction( 'this.doitAction( )' )

-- assign undoable to do-it button callback

!this.doit.setUndoable( !this.doitUndo )

. . .

endmethod

define method .formOK()

-- OKcall callback

. . .

endmethod

define method .doitAction()

-- doit button callback

-- actions for doit/re-doit

. . .

endmethod

define method .undoitAction( )

-- undo method for doit button

-- actions to undo the doit/re-doit action

. . .

endmethod

Notes:

In most cases, the undoAction and redoAction of the UNDOABLE object are not required! This is because undo/redo is essentially linked to the state of the AVEVA E3D database rather than to the state of a form or its gadgets. Once a form is dismissed from the screen, its state is not usually maintained, but is regenerated by the INIT callback next time it is displayed. Most forms which are sensitive to database changes, and remain displayed, are updated via their AUTOCALL callback (Tracker system), which again removes the need for explicit undo/redo support.

The UNDOABLE object must be a form member (preferred) or a Global variable or it cannot be held by F&M.When a callback is executed, if an UNDOABLE object is present, then F&M modifies the undo/redo stack by means of the following actions:

undoable.Add( )

execute gadget callback

undoable.endUndoable( )

Methods to assign a AVEVA E3D UNDOABLE object to a callback, and to query a callback's UNDOABLE object are supported.

Not all callbacks are candidates for undo/redo. The following sections detail what is possible.

TitleResults for “How to create a CRG?”Also Available in