cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Changing the colour of a button when clicked

Hi

 

 

I've got a button which OnSelect sets a variable which I use later to die or show fields. How would I get the colour of the same button to change when it's clicked? Do I need to select a Property and what would I need to put in it? 

 

Thanks in advance.

1 REPLY 1
Highlighted
Super User
Super User

Re: Changing the colour of a button when clicked

Buttons have a PressedColor property you can edit. Does that answer your question or do you want the button to toggle colors when it's pressed?

To toggle the button's color, put this formula wherever you see fit (Application's OnStart or Form's OnVisible)

 

ClearCollect(ButtonColors,{Pressed:true,Color:RGBA(255, 0, 0, 1)},{Pressed:false,Color:RGBA(0, 255, 0, 1)});
Set(ButtonPressed,false);

 

Replace the color values with whatever colors you'd like.
Then, on the button you want to toggle, put this formula in the OnSelect property somewhere

 

Set(ButtonPressed,!ButtonPressed);

 

 Finally, on the button's Fill property, put this formula

 

LookUp(ButtonColors,Pressed=ButtonPressed,Color)

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,003)