PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Formatting Columns in a Table
Formatting Columns in a Table
Débuté par David Egan, 02 oct. 2005 00:23 - 5 réponses
Posté le 02 octobre 2005 - 00:23
Hi
In a table I want to have some columns displayed in bold if there is a specific value in one of the fields. I have tried setting this in the RowDisplay process but this then affects every row in the table. I will also want to display value columns in red if they are negative which appears to me to be the same issue. I would have thought this would be fairly simple but being new to Windev I am struggling to find where I set it. I'm using Windev 8. Any suggestions?
Thanks
David
Posté le 02 octobre 2005 - 01:07
G'day David
You can change row and column colours but not an individual table cell - unless this has changed in the latest update.
If you only have V9 help you are at a disadvantage because the control properties help is still a mix of English and French. In V9 you will find the font properties for controls under ..Police - in French

//table row in a table named "TABLE"
IF TABLE.Active <> 1
//using file references for colurs
TABLE[TABLE]..BrushColor=SysInfo3.InactiveBGrndColour
TABLE[TABLE]..Color=SysInfo3.InactiveTxtColour
//using a constant
TABLE[TABLE]..BrushColor=iLightGray
TABLE[TABLE]..Color=iLightRed
END
//Table column
TABLE.ACCOUNTNAME..BrushColor=SysInfo3.InactiveBGrndColour
//change the font to bold
TABLE.ACCOUNTNAME..FontBold = True

Regards
Al
Posté le 02 octobre 2005 - 07:52
Hi, Al,
The individual table cell's colour can be changed :
Tablexxx[i][j]..brushcolor =iblack
works in Windev9 90034iu
regards
robert zhong
G'day David
You can change row and column colours but not an individual table cell - unless this has changed in the latest update.
If you only have V9 help you are at a disadvantage because the control properties help is still a mix of English and French. In V9 you will find the font properties for controls under ..Police - in French

//table row in a table named "TABLE"
IF TABLE.Active <> 1
//using file references for colurs
TABLE[TABLE]..BrushColor=SysInfo3.InactiveBGrndColour
TABLE[TABLE]..Color=SysInfo3.InactiveTxtColour
//using a constant
TABLE[TABLE]..BrushColor=iLightGray
TABLE[TABLE]..Color=iLightRed
END
//Table column
TABLE.ACCOUNTNAME..BrushColor=SysInfo3.InactiveBGrndColour
//change the font to bold
TABLE.ACCOUNTNAME..FontBold = True

Regards
Al
Posté le 02 octobre 2005 - 09:59
Hi guys
Thanks for the help. Am I correct in assuming therefore that after populating the table I need to check the values displayed in the table cells and then change the cell properties based on that, rather than relying on the value of the underlying file to control this. If this is correct where do I do this. I would have thought that I would place my code in Row Display but this doesn't seem to work when first displaying the table as CurrentSubscript(), which I am using to ascertain the line number, always returns 0.
Regards
David
Posté le 02 octobre 2005 - 10:27
Please ignore my previous post. I should have read your answer more carefully. Using Table[Table] works beautifully coded in row display. Once again thanks for your help.
David
Posté le 02 octobre 2005 - 10:51
G'day David
Table display is the correct code section for what you are trying to do as it will cope with sorting and column shifting
You don't need to nominate the row number in tabledisplay because Table[Table].. refers to the current row being displayed. Add in the info from Robert about the columns and Table[Table][1]..brushcolour = Ilightred will change the current row/column 1 to red
If you lock your table columns you could simply nominate them by number otherwise you would need to use the TableEnumColumn command in a loop to return the current column number for a named column
Regards
Al