ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Table control
  • Overview
  • Changing the text color
  • Changing the background color
  • Differences between Table controls based on a data file and populated programmatically
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
The colors of a Table control (row background, text of rows, etc.) are defined in the control description window. They can be modified using the following properties:
Remark: You can define the cell border line color with the Border property.
Changing the text color
To change the text color:
  • for all the columns of the Table control:
    <Table control>.Color = <Color value>
  • for a column:
    <Column control>.Color = <Color value>
  • for a row of the Table control:
    <Table control>[<Row>].Color = <Color value>

    <Column>[<Row>].Color = <Color value>
  • for a cell of the Table control:
    <Table control>[<Row>][<Column>].Color = <Color value>

    <Column control>[<Row>][<Column>].Color = <Color value>
In these syntaxes:
  • <Table control>:
    Table control name.
  • <Column control>:
    Column name.
  • <Row>:
    Integer used to identify the row to modify. There is no need to specify this parameter if the row to modify is the current row.
  • <Column>:
    Number of the column that contains the cell to be modified. The column numbers include all the columns, even the ones that are hidden or inactive. The first column (on the left) is column #1, the second one is column #2...
  • <Color value>:
    Integer containing the value of the color. This value can correspond to:
Remark: DefaultColor cannot be used to cancel the change of color for the entire Table control. Changing the color of the Table control means changing the style of the control, and the new color becomes the default color.
To change the color of a Table control and then to go back to the previous color, you must change it row by row or column by column.
Examples:
// Table control: Yellow text
TABLE_Table1.Color = LightYellow
// Use the RGB components
TABLE_Table1.Color = RGB(10, 0, 90)
 
// Table control with yellow background for the NAME column
COL_NAME.Color = LightYellow
// Use the RGB components
COL_NAME.Color = RGB(10, 0, 90)
// Cancel the colors
COL_NAME.Color = DefaultColor
 
// Write the text displayed in a row in red
// TABLE_Table1[TABLE_Table1] returns the subscript of the row currently displayed
IF COL_Amount > 10 THEN
TABLE_Table1[TABLE_Table1].Color = LightRed
END
// Cancel the colors
TABLE_Table1[TABLE_Table1].Color = DefaultColor
 
// Table control with a cell whose text is dark blue
TABLE_Table1[10][2].Color = DarkBlue
// Cancel the colors
TABLE_Table1[10][2].Color = DefaultColor
Changing the background color
To change the background color:
  • for all the columns of the Table control:
    <Table control>.BackgroundColor = <Color value>
  • for a column:
    <Column control>.BackgroundColor = <Color value>
  • for a row of the Table control:
    <Table control>[<Row>].BackgroundColor = <Color value>

    <Column control>[<Row>].BackgroundColor = <Color value>
  • for a cell of the Table control:
    <Table control>[<Row>][<Column>].BackgroundColor = <Color value>

    <Column control>[<Row>][<Column>].BackgroundColor = <Color value>
In these syntaxes:
  • <Table control>:
    String containing the name of the Table control.
  • <Column control>:
    String containing the name of the column.
  • <Row>:
    Integer used to identify the row to modify. There is no need to specify this parameter if the row to modify is the current row.
  • <Column>:
    Number of the column that contains the cell to be modified. The column numbers include all the columns, even the ones that are hidden or inactive. The first column (on the left) is column #1, the second one is column #2...
  • <Color value>:
    Integer containing the value of the color. This value can correspond to:
Examples:
// Table control: yellow background
TABLE_Table1.BackgroundColor = LightYellow
// Use the RGB components
TABLE_Table1.BackgroundColor = RGB(10, 0, 90)
 
// Table control with yellow background for the COL_NAME column
COL_NAME.BackgroundColor = LightYellow
// Use the RGB components
COL_NAME.BackgroundColor = RGB(10, 0, 90)
// Cancel the colors
COL_NAME.BackgroundColor = DefaultColor
 
// Display a row in red
// TABLE_Table1[TABLE_Table1] returns the subscript of the row currently displayed
IF COL_Amount > 10 THEN
TABLE_Table1[TABLE_Table1].BackgroundColor = LightRed
END
// Cancel the colors
TABLE_Table1[TABLE_Table1].BackgroundColor = DefaultColor
 
// Table control with a cell whose background color is dark blue
TABLE_Table1[10][2].BackgroundColor = DarkBlue
// Cancel the colors
TABLE_Table1[10][2].BackgroundColor = DefaultColor
Differences between Table controls based on a data file and populated programmatically
Table control populated programmatically
  • The new colors in the Table control are preserved until they are changed again.
  • The new color of a row or cell is preserved: when scrolling the content of the Table control vertically or horizontally, the new color of the row or cell remains "active".
Table control based on a data file
  • The new colors in the Table control are preserved until they are changed again.
  • The new color of a row or cell is not preserved: when scrolling the content of the Table control vertically or horizontally, the new color of the row or cell is lost when the row is no longer displayed in the Table control.
    To preserve the new color, it must be called in the display process of a row in the Table control.
Example: make the cell red if AMOUNT to pay >10
IF COL_AMOUNT > 10 THEN
TABLE_Table1[TABLE_Table1][2].Color = LightRed
// COL_AMOUNT is the second column of the Table control
// TABLE_Table1[TABLE_Table1][2] represents the cell that corresponds to
// column 2 for the current row.
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Exemplo Cores Tabela
Exemplo Cores Tabela

//Blog com Video E Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/09/aula-926-curso-windev-tabela-032-tabela.html

https://www.youtube.com/watch?v=6XWstwl1WQA

De matos
30 Sep. 2016

Last update: 04/06/2023

Send a report | Local help