PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Method 1: Using control processes
  • Method 2: Using the Event function
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
The caret is not always easy to identify in a window: sometimes, we may not not even know the control where the input is performed.
How to highlight the control where the input is performed?
Two methods are available:
Method 1: Using control processes
  • In the entry code of control, change the background color and/or the color of characters with ..BrushColor and ..Color.
  • In the exit code of control, use the default style color for the background color and/or for the color of characters with ..BrushColor and ..Color associated with the DefaultColor constant.
Example:
// -- Entry process of control
MySelf..BrushColor = DarkBlue
MySelf..Color = White
// Loss of focus
MySelf..BrushColor = DefaultColor
MySelf..Color = DefaultColor
Drawback: This operation must be performed on each control ... manually. 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 typed in the initialization code of project:
    Event(ProcColor, "*.*", 7) // 7 = WM_SETFOCUS
    Event(ProcUncolor, "*.*", 8) // 8 = WM_KILLFOCUS
  • Global WLanguage procedure called by the Event function (gain of focus):
    PROCEDURE ProcColor
    {_EVE.name, indControl}..BrushColor = DarkBlue
    {_EVE.name, indControl}..Color = White
  • Global WLanguage procedure called by the Event function (loss of focus):
    PROCEDURE ProcUncolor
    {_EVE.name, indControl}..BrushColor = DefaultColor
    {_EVE.name, indControl}..Color = DefaultColor
Minimum required version
  • Version 14
Comments
Click [Add] to post a comment