PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → WDM22 - Change Color In Looper
WDM22 - Change Color In Looper
Débuté par André Labuschagné, 25 aoû. 2018 21:27 - 3 réponses
Posté le 25 août 2018 - 21:27
Hi All

I am needing to change the colour of a control in a looper based on a condition. Here is the code I have tried:

TheMax is int = LOOP_MyLooper..Occurrence

FOR Rec = 1 TO TheMax

IF LOOP_MyLooper.ATT_MyStatus[Rec]..Value = "MyCondition" THEN
LOOP_MyLooper.ATT_MyStatusColor[Rec]..Color = DarkGreen
END

END

Attribute MyStatus is set to Value
Attribute MyStatusColor is set to Color

Any ideas what I am doing wrong?

Cheers
André
Posté le 25 août 2018 - 21:41
Hi,

IF LOOP_MyLooper.ATT_MyStatus[Rec]..Value = "MyCondition" THEN
LOOP_MyLooper.ATT_MyStatusColor[Rec]..Color = DarkGreen
END

Should this be

IF LOOP_MyLooper.ATT_MyStatus[Rec]..Value = "MyCondition" THEN
LOOP_MyLooper.ATT_MyStatusColor[Rec]..Color = DarkGreen
END
Posté le 26 août 2018 - 00:29
Hi André,

to complete Peter's message

An attribute is NOT a control where you can use properties.
An attribute is linked to ONE SPECIFIC property of a control.

So you need ot create an attribute linked to the color

Best regards
Posté le 26 août 2018 - 23:51
Howdy

Thanks Peter - understood.

Thanks Fabrice - understood - you will notice that I have an attribute linked to the color property of the control but was addressing it incorrectly as per Peter's post.

Still learning here - phew - so much to still understand.

Cheers
André