|
|
|
|
|
WinEdDo (Function) In french: FenEdDo Runs an action (defined programmatically) and enables Undo/Redo operations on this action. This function is linked to the "Allow end users to modify the UI" feature. This function is mainly used when creating an editor through programming (see "Remarks"). WinEdDo(FEN_MonEditeur, ProcCréeLib, "Nouveau")
INTERNAL PROCEDURE ProcCréeLib(sLib)
pNouveau is Control
pNouveau <- ControlCreate("LIB_" + GetIdentifier(), typText, 150, 150, 80, 20)
pNouveau.Libellé = sLib
WinEdDeclareUndo(ProcAnnuler)
INTERNAL PROCEDURE ProcAnnuler()
ControlDelete(pNouveau)
END
END
Syntax
WinEdDo(<Window> , <WLanguage procedure> [, <Parameter 1> [... [, <Parameter N>]]])
<Window>: Window name Name of the window or internal window to be used. This window must be in edit mode (WinEdActive). <WLanguage procedure>: Procedure name Name of WLanguage procedure to run. The code of this procedure must call WinEdDeclareUndo. The actions of this procedure will be taken into account in Undo/Redo.Note: Using an internal procedure allows direct access to local variables. <Parameter 1>: Any optional type First optional parameter that will be passed to the procedure. <Parameter N>: Any optional type Nth optional parameter that will be passed to the procedure. Remarks Use example WinEdDo is used to create custom actions (control creation for example) that support the undo/redo. Let's take a simple example: creating a graphical object editor. A button is used to create a shape. The user must have the ability to undo the shape creation. The following operations are performed: - The window switches to edit mode (WinEdActive).
- Calling WinEdDo. The procedure called by this function is used to create the shape. This procedure also contains the call to WinEdDeclareUndo. WinEdDeclareUndo is used to define the behavior in case of user cancellation.
- The window switches to standard mode (WinEdActive).
The end user can undo this action (Ctrl + Z or WinEdUndo) and eventually redo it (Ctrl + Y or WinEdRedo).
Related Examples:
|
Training (WINDEV): WD Graphic Objects
[ + ] This example illustrates the power of WLanguage in object oriented programming. This example is a graphic object editor. It is possible to: - move, resize objects - make selections with a lasso or a mouse - cut/copy/paste objects - delete/duplicate objects - save the created documents and print them. The main technical features presented and documented are: - management of an object clipboard - UNDO/REDO management - serialization and deserialization of objects - algorithms for managing graphic objects (proportional resizing, management of move rules, etc...)
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|