Undo/Redo
Undo is one of the important functions of a good user interface in interactive applications. Without undo, correcting a false instruction is often very time consuming. Undo and redo functionality is a fundamental design decision and cannot be easily added at a later time.
A decent application must support undo. If a specific function/command does not support undo/redo, undo/redo must be disabled for those commands (by clearing the undo/redo queues after command execution).
An undo step is the smallest granularity at which the user can interact with the Undo system. A user always undoes/redoes an entire undo step. Undo steps should be named and this name will be presented in the UI if the user presses one of the undo/redo menu popups.
An undo step typically contains of multiple Changes.
UndoContext gives access to a state based undo mechanism for ProjectObjects. Each Project has its own UndoContext. The UndoContext makes it possible to group changes to ProjectObjects. All changes in the group can then be undone and redone.
Every state-changing call to the RobotStudio API will result in changes being added to the current undo step. The figure below describes how the changes in objects are grouped together.
RobotStudio supports undo-redo of actions. Hence any application that would be a part of RobotStudio is interacting with the Robot Studio objects should also support undo – redo, inorder to have a seamless user experience. The figure below describes an Add-In which has made use of the Undo /Redo mechanism, and has some User Interface controls like treeview which needs to be updated based on the action performed.
To encapsulate a number of changes into an undo step follow this tutorial which described how
to work with Undo