is used to handle the current control. When the project is run, MySelf
is replaced with the control (and not by the name of the control). Therefore, MySelf
is used as a control.
Benefit: MySelf is used to make a local code (control, item, and so on) or a global code (global procedure, class, and so on) independent of the current control.
// - Whenever a Combo Box control is modified
// Call the UpperMask procedure
// --UpperMask procedure
// Capitalize the 1st letter for an editable Combo Box control
Value = MySelf
IF Length(Value) > 1 THEN
CursorPosition = MySelf.Cursor
MySelf = Upper(Value[]) + ...
Lower(Value[[2 TO Length(Value)]])
MySelf.Cursor = CursorPosition
Handling the current control
- MySelf is always replaced with the current control. For example:
- Retrieving the value of the current control:
Modifying the value of the current control:
- Using a property (Caption for example):
MySelf.Caption = "Name of customers"
ControlCaption = MySelf.Caption
- Passing a parameter:
- A WLanguage error occurs if there is no current control.
Using MySelf in a procedure
- MySelf can be used in a local procedure or in a global procedure only if the procedure is called in a process associated with a control. In this case, MySelf refers to the current control.
- MySelf is used to make a procedure "generic": the name of the control is not spelled out. This procedure can be called by several controls.
WLanguage functions and current control
To specify the current control in the WLanguage functions that accept a control name as parameter, use:
- an empty string,
- Myself directly.
In WINDEV or WINDEV Mobile:
|Code where MySelf is used ||MySelf corresponds to |
|window procedure, with a direct call from a window code||control on which the event was triggered|
|window procedure, with a call via <Window>.<Procedure>||window|
|control of window supercontrol||control|
|procedure of window supercontrol with a direct call from a code of the supercontrol||control on which the event was triggered|
|procedure of window supercontrol with a call via <Supercontrol>.<Procedure>||supercontrol|
|internal window||internal window|
|control of internal window||control|
|procedure of internal window with a direct call from a code of the internal window||control on which the event was triggered|
|procedure of internal window with a call via <InternalWindow>.<Procedure>||internal window|
|supercontrol of internal window||supercontrol|
|control of supercontrol of internal window||control|
|procedure of supercontrol of internal window with a direct call from a code of the supercontrol||control on which the event was triggered|
|procedure of supercontrol of internal window with a call via <Supercontrol>.<Procedure>||supercontrol|