PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • How do I modify the classes of Object RAD?
  • Modifying the classes of Object RAD via the inheritance
  • Modifying the classes of Object RAD via procedures
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
Modifying the classes of Object RAD
Warning
From version 12, this feature is kept for backward compatibility.
How do I modify the classes of Object RAD?
The code of the classes of Object RAD can be viewed. Two techniques can be used to modify the classes of Object RAD:
1. The class inheritance:
This technique consists in overloading the preset methods found in the classes of Object RAD.
This technique is recommended when the modification performed affects the general operating mode of the application.
2. The use of local procedures:
This technique consists in defining local procedures in the window managed by RAD. This local procedure contains your custom code.
This technique is recommended when the customization of RAD affects a single window.
Modifying the classes of Object RAD via the inheritance
To modify the operating mode of the classes of Object RAD via the inheritance:
1. Create a new class in the code editor ("Code" pane, "Class" option).
2. In the declaration code, define the base class and the derived class.
CMyTable is Class
        inherits from CWDTable
END
3. In the constructor code of the derived class, call the constructor of the base class with the necessary parameters.
PROCEDURE cMyForm::Constructor(FileName, KeyName)
Constructor CWDForm(FileName, KeyName)
4. Add the methods into your class ("New method" from the popup menu of the "Code" pane, "Class" option). These methods have the same name as the methods found in the base class of Object RAD. The name of the method must be preceded by the VIRTUAL keyword.
Note: All the methods can be overloaded. The methods whose name is preceded by the _ character are protected methods.
PROCEDURE VIRTUAL _vRefresh()
Trace("My class is used")
5. In the initialization code of the window, declare an object of your class. This declaration replaces the declaration code of the object generated by RAD.
// Code generated by default
// GLOBAL
// gclTable is object CWDTable
GLOBAL
gclTable is object CMyTable
Modifying the classes of Object RAD via procedures
To modify the Object RAD via local procedures:
  1. Create one or more of the following local procedures in your window:
    • Table window:
      RADDisplay procedure: Procedure run when refreshing the table and whenever a row is selected.
    • Form window:
      • RADDisplay procedure: Procedure run during the automatic refresh.
      • RADClear procedure: Procedure run in creation mode to initialize the controls with their default values.
      • RADSave procedure: Procedure run when validating a form.
  2. Enter your custom code in these procedures.
Note: As soon as one of these procedures is found in a window generated by RAD, this procedure is automatically called.
See also
Minimum required version
  • Version 9
Comments
Click [Add] to post a comment