|
|
|
|
|
- Method 1: Using WLanguage events associated with the field
- Method 2: Using the Event function
How to color a control with focus?
The keyboard cursor ("carret") is not always easy to locate in a window: it's not always clear which field you're typing in. How to highlight the control where the input is performed? Two methods are available: Method 1: Using WLanguage events associated with the field - In the entry code of control, change the background color and/or the color of characters with BackgroundColor and Color.
- In the exit code of the control, use the default style color for the background color and/or color of characters with BackgroundColor and Color with the DefaultColor constant.
Example:
MySelf.CouleurFond = DarkBlue
MySelf.Couleur = White
MySelf.CouleurFond = DefaultColor
MySelf.Couleur = DefaultColor
Disadvantage: This operation must be performed "manually" on each field.. This method is convenient if a small number of controls must be modified. Method 2: Using the Event function Event is used to intercept the Taking Focus and Losing Focus events in the project or in each window to process. Each one of the events must be associated with a WLanguage procedure in order to change the color or to restore the initial color. Example: - Code to enter in the "Initialization" event of the project:
Event(ProcColorie, "*.*", 7)
Event(ProcDeColorie, "*.*", 8)
- Global WLanguage procedure called by the Event function (gain of focus):
PROCEDURE ProcColorie
{_EVE.name, indControl}..BackgroundColor = DarkBlue
{_EVE.name, indControl}..Color = White
- Global WLanguage procedure called by the Event function (loss of focus):
PROCEDURE ProcDeColorie
{_EVE.name, indControl}..BackgroundColor = DefaultColor
{_EVE.name, indControl}..Color = DefaultColor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|