I'm trying to create a simple UI that will change the color of a Rectangle control when it is clicked on.
I'm Set 5 of our brand colors as global variables.
I'm trying to figure out why this switch statement only toggles back and forth between the first two colors?
Switch(
CurrentColor = ard_Black,
Set(
CurrentColor,
ard_Gray
),
CurrentColor = ard_Blue,
Set(
CurrentColor,
ard_Orange
),
CurrentColor = ard_Gray,
Set(
CurrentColor,
ard_Blue
),
CurrentColor = ard_Orange,
Set(
CurrentColor,
ard_Purple
),
CurrentColor = ard_Purple,
Set(
CurrentColor,
ard_Black
)
);
The switch syntax is incorrect. Here's how it should look like
Switch( test.Value, somevalue, "Result1", somevalue1, "Result2", somevalue2, "Result3")
Here's how your switch statement should be
Switch(
CurrentColor,
ard_Black,
Set(
CurrentColor,
ard_Gray
),
ard_Blue,
Set(
CurrentColor,
ard_Orange
),
ard_Gray,
Set(
CurrentColor,
ard_Blue
),
ard_Orange,
Set(
CurrentColor,
ard_Purple
),
ard_Purple,
Set(
CurrentColor,
ard_Black
)
);
I have tried that and it is still not working.
I should have also noted, at the app startup i Set(CurrentColor, ard_Black) - not sure if that clears up why i was attempting to do CurrentColor = ard_Black as my test.Value.
I'm having trouble understanding the syntax - what is somevalue?
@datapawn if you want to change the color of the rectangle on click, there is an other way to do it. In the above syntax, you are comparing CurrentColor and setting a new value which leads to ambiguity.
Use PressedFill property to change the Fill color value of the rectangle on click.
User | Count |
---|---|
247 | |
106 | |
82 | |
51 | |
43 |