ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage properties / Various properties
  • Font variable
  • Color of an Edit control
  • Text color in a Static Text control
  • Text color of a Button control
  • Text color of a Radio Button or Check Box control
  • Text color of a List Box or Combo Box control
  • Color of a TreeView control
  • Text color of a cell, row or column in a Table control
  • Limitations
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The Color property gets or sets the font color of:
  • a variable of type Font.
  • text displayed in a Static or Calculated control of a report.
  • text displayed in a window control.
  • text displayed in a page control.
  • text in a menu option.
The effects of the Color property depend on the type of control (for more details, see "Remarks").
Note: By default, the color of a Font variable is black.
Example
// The text color is modified according to the displayed value
IF EDT_Total>15000 THEN
EDT_Total.Color = LightRed
END
WEBDEV - Server codePHPAjax
// Définir les caractéristiques d'une variable de type Police
Police1 is Font
Police1.Name = "Arial"
Police1.Color = LightYellow
Police1.Size = 14
Police1.SizeUnit = unitPoint
Police1.Orientation = 45
// Appliquer la police au champ "MonChamp"
MyControl.Police = Police1
Syntax

Getting the text color Hide the details

<Result> = <Element used>.Color
<Result>: Integer or constant
Color of the specified element. This color can correspond to:
WEBDEV - Browser code The color is returned as a string by the browser.
<Element used>: Control name or Font variable
Name of the element for which you want to get the text color. This element can correspond to:
  • name of a control in a window or page.
  • name of a control in a report.
  • name of a variable of type Font.

Changing the text color Hide the details

<Element used>.Color = <New color>
<Element used>: Control name or Font variable
Name of the element for which you want to change the text color. This element can correspond to:
  • name of a control in a window or page.
  • name of a control in a report.
  • name of a variable of type Font.
<New color>: Integer or constant
New color of the specified element. This color can correspond to:
Remarks

Font variable

A font can be created from a Font variable.
To define the font characteristics, use:
This font can be used:
Assigning a font to a control:
  • if the Font variable has no specific color, the color of the text displayed in the control is kept.
  • if the Font variable has a specific color, this color is applied to the text displayed in the control.

Color of an Edit control

The Color property can be used to identify and modify the color of text entered.
WEBDEV - Server codePHPAjax

Text color in a Static Text control

The Color property lets you identify and modify the text color of a Static Text control.
WEBDEV - Server codePHPAjax

Text color of a Button control

The Color property lets you identify and modify the color of the text in a Button field.
WEBDEV - Server codePHPAjax

Text color of a Radio Button or Check Box control

The Color property can be used to identify and modify the text color of all Radio Button control and Check Box control options.
WEBDEV - Browser codePHP

Text color of a List Box or Combo Box control

The Color property gets and sets the text color of all the options of a List Box control.
WEBDEV - Server codePHPAjax

Color of a TreeView control

The Color property gets and sets the color of all the labels displayed in a TreeView control.
To get or change the text color of an option in the TreeView control, specify the desired option using one of the following syntaxes:
  • TreeViewName[RowNum]
  • TreeViewName[<Element path>] where Element path is a character string in the following format:
    "<Root name>" + TAB + ["<Name of 1st node>" + TAB +...
    ["<Name of 2nd node>" + TAB + [...]]]"<Leaf name>"
    Examples:
TREE_TreeView2[2].Color = LightGreen // Colors the second row green
TREE_MyTreeView["Recipe" + TAB + "Dessert"].Color = LightRed
WEBDEV - Server codeWEBDEV - Browser codePHPAjax

Text color of a cell, row or column in a Table control

  • To get or change the text color of a cell in a Table control, specify the desired cell using the following syntax: TableName[RowNum][ColumnNum].
    For example, the following code changes the text color in the cell on row 1, column 2:
    TABLE_Table1[1][2].Color = DarkBlue
  • To get or change the text color of a row in a Table control, specify the desired row using the following syntax: TableName[RowNum].
  • To get or change the text color of a column in a Table control, simply use the Color property with the column name.
Caution: To preserve text color when selecting a line in a Table based on a data file field, you need to use the Color property in the "Select table line" event..
WEBDEV - Browser code The Color property is available in browser code only for Table controls in "Browser" mode on:
  • Table rows (browser).
  • Table columns (browser).
  • Table cells (browser).
This property is not available in browser code for Table controls in "Server" or "Server + AJAX" mode.

Limitations

WEBDEV - Server code Limitations on report controls
The Color property has no effect on:
  • Image controls.
  • Bar Code controls.
  • RTF controls.
  • Check Box controls.
  • Chart controls.
  • Signature controls.
  • reports.
  • report blocks.
WEBDEV - Browser code The Color property can only be used in the following controls:
  • Edit controls.
  • List Box controls.
  • Combo Box controls.
  • Static Text controls.
  • elements of a List Box control.
  • elements of a Combo Box control.
  • HTML Static controls.
  • 3-state Button controls.
  • formatted display controls.
  • browser table rows.
  • browser table columns.
  • browser table cells.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/06/2025

Send a report | Local help