PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Use example
  • Error
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Declares how to cancel an action that was added by WinEdDo. This function is linked to the "Modification of the interface by the end user" feature.
This function is mainly used when creating an editor by programming (see the "Notes").
Example
WinEdDo(WIN_MyEditor, ProcCreateCap, "New")
INTERNAL PROCÉDURE ProcCreateCap(sCap)
pNew is Control
pNew <- ControlCreate("STC_" + GetIdentifier(), typText, 150, 150, 80, 20)
pNew..Caption = sCap
WinEdDeclareUndo(ProcCancel)
INTERNAL PROCÉDURE ProcCancel()
ControlDelete(pNew)
END
END
WinEdDeclareUndo(UndoOperation, CUSTOMER.CustomerID)

// Management of Undo
INTERNAL PROCÉDURE UndoOperation(nCustomerID)

IF HReadSeekFirst(CUSTOMER, CustomerID, nCustomerID) THEN
   SourceToScreen()
END
Syntax
WinEdDeclareUndo(<Procedure Name> [, <Parameter 1>, ...,  <Parameter N>])
<Procedure Name>: Character string (with or without quotes)
Name of WLanguage procedure to run. The code of this procedure must allow to cancel the action created by WinEdDo.
Using an internal procedure provides a direct access to the local variables.
<Parameter 1>: Any optional type
First optional parameter that will be passed to the procedure.
In most cases, these parameter are values used to restore the previous status.
<Parameter N>: Any optional type
Nth optional parameter that will be passed to the procedure.
In most cases, these parameter are values used to restore the previous status.
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 an editor of graphic objects.
A button is used to create a shape. The user must have the ability to cancel the creation of the shape. The following operations are performed:
  • Switching the window to modification mode (WinEdActive).
  • Call to 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 cancelation.
  • Switching the window to normal mode (WinEdActive).
The end user can cancel this action (CTRL + Z or call to WinEdUndo): then, <Procedure Name> will be called.

Error

A WLanguage error occurs if WinEdDeclareUndo is called outside a procedure added by WinEdDo.
Related Examples:
WD Graphic Objects Training (WINDEV): WD Graphic Objects
[ + ] This educational example illustrates the power of WLanguage regarding object-oriented programming.
This example is an editor of graphic objects.

You have the ability to:
- move, resize the objects
- perform selections with the lasso or with the mouse
- cut/copy/paste objects
- delete/duplicate objects
- save the created documents and print them.

The main technical features presented and documented in this example are as follows:
- managing a clipboard of objects
- managing UNDO/REDO
- serializing and deserializing objects
- OOP
- algorithms for managing graphic objects (proportional resize operations, management of movement rules, etc.)
Components
WINDEVReports and Queries wd230obj.dll
Minimum required version
  • Version 21
This page is also available for…
Comments
Click [Add] to post a comment