ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
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 Table field linked to a data file/Table field populated programmatically
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
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:
Note: You can define the cell frame and its color using the Border property..
Changing the text color
To modify the color of the text:
  • 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:
Note The color DefaultColor does not cancel the color change 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:
// Champ Table : Texte jaune
TABLE_Table1.Couleur = LightYellow
// Utilisation des composantes RVB
TABLE_Table1.Couleur = RGB(10,0,90)

// Champ Table avec colonne NOM avec fond jaune
COL_NOM.Couleur = LightYellow
// Utilisation des composantes RVB
COL_NOM.Couleur = RGB(10,0,90)
// Annulation des couleurs
COL_NOM.Couleur = DefaultColor

// Mettre le texte d'une ligne en rouge
// TABLE_Table1[TABLE_Table1] retourne l'indice de la ligne en cours d'affichage
IF COL_Montant > 10 THEN
	TABLE_Table1[TABLE_Table1].Couleur = LightRed
END
// Annulation des couleurs
TABLE_Table1[TABLE_Table1].Couleur = DefaultColor

// Champ Table avec une cellule avec texte Bleu foncé
TABLE_Table1[10][2].Couleur =DarkBlue
// Annulation des couleurs
TABLE_Table1[10][2].Couleur = 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:
// Champ Table : fond jaune
TABLE_Table1.CouleurFond = LightYellow
// Utilisation des composantes RVB
TABLE_Table1.CouleurFond = RGB(10,0,90)

// Champ Table avec colonne COL_NOM avec fond jaune
COL_NOM.CouleurFond = LightYellow
// Utilisation des composantes RVB
COL_NOM.CouleurFond = RGB(10,0,90)
// Annulation des couleurs
COL_NOM.CouleurFond = DefaultColor

// Mettre une ligne en rouge
// TABLE_Table1[TABLE_Table1] retourne l'indice de la ligne en cours d'affichage
IF COL_Montant > 10 THEN
	TABLE_Table1[TABLE_Table1].CouleurFond = LightRed
END
// Annulation des couleurs
TABLE_Table1[TABLE_Table1].CouleurFond = DefaultColor

// Champ Table avec une cellule Bleu foncé
TABLE_Table1[10][2].CouleurFond = DarkBlue
// Annulation des couleurs
TABLE_Table1[10][2].CouleurFond = DefaultColor
Differences Table field linked to a data file/Table field populated programmatically
Table control populated programmatically
  • The new colors in the Table control are preserved until they are changed again.
  • The color change associated with a row or cell is memorized: when dequeuing (vertically and horizontally) the contents of the Table control, the color change associated with the row or cell remains "active".
Data-bound Table control
  • The new colors in the Table control are preserved until they are changed again.
  • The color change associated with a row or cell is not memorized: when dequeuing (vertically and horizontally) the contents of the Table control, the color change associated with the row or cell is lost when the row "exits" the Table control.
    To preserve the new color, it must be called in the display process of a row in the Table control.
Example: display the cell in red if REMAINING 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/2025

Send a report | Local help