I have a grid with 200 buttons.
When you select one button I want to change the fill color to red and then when you click on another button I want the previous button to go back to transparent and the new button to go red. Is it there any easy way to do this?
The code I run today change the colors but the problem is that the button you clicked stays red until you click it again. I want this to go automatically when pressing a new button.
Onselect: UpdateContext({pressedButton:!pressedButton})
Fill: If(pressedButton=true; Color.Transparent; Color.Red)
I found it, what has to be the solution is out dated and don't work any more.
The new code is:
'OnSelect': (Example)
UpdateContext({Button: !Button})
Then the 'Fill':
If(Button = true; Color.Black; Color.White)
It is supported with css colors so you can just write the name of the color.
What would be the opposite of "pressedbutton"?
Ex: Say I used updatecontext:({pressedbutton:button1}) under the onselect for button1. I then set the fill for button1 to If(button1=pressedbutton, color.green, color.yellow), but I want a second button to reset the status of button so that it will go back to being yellow.
I want to change the color of the icon when a person click on the icon in the gallery . If there are 1000 of rows in the gallery then by changing a color we can specify that we have visited this row already and it should be on the basis of user. when a new person login on the app the default color should be there
It's hard to tell what you have in your image...if this is a Gallery, then you can set the TemplateFill property as follows:
If(ThisItem.IsSelected, Red, Transparent)
If it is a button you have (which is not obvious in your image), then you can set the Fill property to the same formula above.
I hope this is helpful for you.
Am assuming your buttons are in a gallery (if not put them in a Gallery with ID ) such as:
That is, find a way of adding unique field into your table or collection if non existent already. Then put that on the Gallery.
After the above, try:
OnSelect
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional