Undo or redo an action
Overview
Undo an action by using the Undo method and redo it by using the Redo method.
Example
- Create a transient object that lists the number of possible undos and redos.
- Check the number of possible undos and redos.
- Create a sheet and add two children (list objects) to that sheet.
- Check the number of possible undos and redos.
- Undo the creation of the last list object.
- Check the number of possible undos and redos.
- Redo the creation of the list object.
- Check the number of possible undos and redos.
- Clear the undo buffer.
- Check the number of possible undos and redos.
1. Create a transient object that lists the number of possible undos and redos. qUndoInfoDef: {} is added in the object definition to enable retrieving the number of undos and redos. The list is named UndoList01 ( "qId": "UndoList01").
The client sends:
The engine returns:
The undo list is created and has 2 as a handle.
2. Get the layout of the undo list. The handle of the request is 2 because the list has 2 as a handle.
The client sends:
The engine returns:
Since no action (create/delete, update) has been performed, the undo and redo counters are set to 0 (qUndoCount and qRedoCount are set to 0).
3. Create a sheet Sheet01. The handle of the request is 1 because the CreateObject method applies at app level and the handle of the app is 1.
The client sends:
The engine returns:
The sheet Sheet01 is created and has 3 as a handle.
4. Create a list object LI01 in the sheet (qId set to LI01).The handle of the request is 3 which is the handle of the sheet. The list object LI01 is a child of the sheet.
The client sends:
The engine returns:
The list object LI01 is created . Its handle is 4.
5. Create a list object LI02 in the sheet (qId set to LI02).The handle of the request is 3, which is the handle of the sheet. The list object LI02 is a child of the sheet.
The client sends:
The engine returns:
The list object LB01 is created . Its handle is 5.
6. Get the layout of the undo list. The handle of the request is 2 because the list has 2 as a handle.
The client sends:
The engine returns:
The number of possible undos (qUndoCount) is 3 and the number of possible redos (qRedoCount) is 0.
7. Undo the last list object creation. The handle of the request is 1 because the Undo method applies at the app level and the handle of the app is 1.
The client sends:
The engine returns:
The undo is successful (qSuccess is set to true). The list object LI02 is removed.
8. Get the layout of the undo list. The handle of the request is 2 because the list uses 2 as a handle.
The client sends:
The engine returns:
The number of possible undos (qUndoCount) is 2 and the number of possible redos (qRedoCount) is 1.
9. Redo the list object creation. The handle of the request is 1 because the Redo method applies at the app level and the handle of the app is 1.
The client sends:
The engine returns:
The redo is successful (qSuccess is set to true). The list object LI02 is created.
10. Get the layout of the undo list. The handle of the request is 2 because the list uses 2 as a handle.
The client sends:
The engine returns:
The number of possible undos (qUndoCount) is 3 and the number of possible redos (qRedoCount) is 0.
11. Clear the undo buffer. The handle of the request is 1 because the ClearUndoBuffer method applies at the app level and the handle of the app is 1.
The client sends:
The engine returns:
12. Get the layout of the undo list. The handle of the request is 2 because the list uses 2 as a handle.
The client sends:
The engine returns:
The undo buffer is cleared. The number of possible undos (qUndoCount) is 0 and the number of possible redos (qRedoCount) is 0.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!