PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Set Color in a cell on load
Set Color in a cell on load
Débuté par John Marrone, 01 juil. 2004 14:27 - 4 réponses
Posté le 01 juillet 2004 - 14:27
I want to set the color of a cell in my table based on if the cells value equals a certain value. Here is my code and it works when I move to a new row. But I want it to work when the table comes up on the screen. Like in the row init event. Does anybody know where to put the code so when the window appears the cells are in the correct color. Thanks in advance.
LOCAL
RowNum is int = CurrentSubscript()
IF RowNum = 0 THEN RowNum = 1
IF Middle(RaceID,1,1) = "A" THEN
Table_DEMO_QryTest[RowNum][1]..BrushColor = iLightRed
ELSE
Table_DEMO_QryTest[Table_DEMO_QryTest]..BrushColor = iDefaultColor
END

John Marrone
Posté le 01 juillet 2004 - 14:40
Hi John,
try in the table : Row display of table.
Christoph

I want to set the color of a cell in my table based on if the cells value equals a certain value. Here is my code and it works when I move to a new row. But I want it to work when the table comes up on the screen. Like in the row init event. Does anybody know where to put the code so when the window appears the cells are in the correct color. Thanks in advance.
LOCAL
RowNum is int = CurrentSubscript()
IF RowNum = 0 THEN RowNum = 1
IF Middle(RaceID,1,1) = "A" THEN
Table_DEMO_QryTest[RowNum][1]..BrushColor = iLightRed
ELSE
Table_DEMO_QryTest[Table_DEMO_QryTest]..BrushColor = iDefaultColor
END

John Marrone
Posté le 01 juillet 2004 - 15:05
Christoph
This only works after the window has been displayed and I change the current row by clicking on an other row or using the arrow keys to change the row. There has to be a way??
John

Hi John,
try in the table : Row display of table.
Christoph

I want to set the color of a cell in my table based on if the cells value equals a certain value. Here is my code and it works when I move to a new row. But I want it to work when the table comes up on the screen. Like in the row init event. Does anybody know where to put the code so when the window appears the cells are in the correct color. Thanks in advance.
LOCAL
RowNum is int = CurrentSubscript()
IF RowNum = 0 THEN RowNum = 1
IF Middle(RaceID,1,1) = "A" THEN
Table_DEMO_QryTest[RowNum][1]..BrushColor = iLightRed
ELSE
Table_DEMO_QryTest[Table_DEMO_QryTest]..BrushColor = iDefaultColor
END

John Marrone
Posté le 01 juillet 2004 - 15:49
Christoph
Figured it out. Had to put the following code in 2 places as follows.
Had to put this code in the END OF Initalization OF TABLE :
LOCAL
RowNum is int
i is a int

WHEN EXCEPTION IN
FOR i = 1 TO HNbRec( DEMO_QryTest)
RowNum = i
IF Middle(RaceID,1,1) = "A" THEN
Table_DEMO_QryTest[RowNum][1]..BrushColor = iLightRed
ELSE
Table_DEMO_QryTest[Table_DEMO_QryTest]..BrushColor = iDefaultColor
END
HReadNext(DEMO_QryTest)
END
DO
END

Had to put this code in the Row Display of TABLE :
LOCAL
RowNum is int
RowNum = CurrentSubscript()
IF RowNum = 0 THEN RowNum = 1

IF Middle(RaceID,1,1) = "A" THEN
Table_DEMO_QryTest[RowNum][1]..BrushColor = iLightRed
ELSE
Table_DEMO_QryTest[Table_DEMO_QryTest]..BrushColor = iDefaultColor
END

Hope this helps others.

John Marrone
P.S. I have been wanting to use this smily for a while now.

Hi John,
try in the table : Row display of table.
Christoph

I want to set the color of a cell in my table based on if the cells value equals a certain value. Here is my code and it works when I move to a new row. But I want it to work when the table comes up on the screen. Like in the row init event. Does anybody know where to put the code so when the window appears the cells are in the correct color. Thanks in advance.
LOCAL
RowNum is int = CurrentSubscript()
IF RowNum = 0 THEN RowNum = 1
IF Middle(RaceID,1,1) = "A" THEN
Table_DEMO_QryTest[RowNum][1]..BrushColor = iLightRed
ELSE
Table_DEMO_QryTest[Table_DEMO_QryTest]..BrushColor = iDefaultColor
END

John Marrone
Posté le 01 juillet 2004 - 16:03
Try: In the row display code section
IF Middle(RaceID[table],1,1) = "A" THEN
Table_DEMO_QryTest[table]..BrushColor = iLightRed
Bert

I want to set the color of a cell in my table based on if the cells value equals a certain value. Here is my code and it works when I move to a new row. But I want it to work when the table comes up on the screen. Like in the row init event. Does anybody know where to put the code so when the window appears the cells are in the correct color. Thanks in advance.
LOCAL
RowNum is int = CurrentSubscript()
IF RowNum = 0 THEN RowNum = 1
IF Middle(RaceID,1,1) = "A" THEN
Table_DEMO_QryTest[RowNum][1]..BrushColor = iLightRed
ELSE
Table_DEMO_QryTest[Table_DEMO_QryTest]..BrushColor = iDefaultColor
END

John Marrone