cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Button effects

This seems easy but I can't figure it out.   I have a button with red Fill that needs to change to black Fill when pressed, then back to red when pressed again.   It needs to toggle back and forth regardless of how many times it is pressed.   Any suggestions?   Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Memorable Member
Memorable Member

Re: Button effects

You'll have to do it change variable buttonPressed on each button 

 

buttonPressed1

buttonPressed2

.

.

.

View solution in original post

9 REPLIES 9
Highlighted
Memorable Member
Memorable Member

Re: Button effects

In your OnSelect property of button add

 

UpdateContext({pressedButton:!true})

 

Change Fill property to

 

If(pressedButton=true, Color.Black, Color.Red)

Highlighted
Super User
Super User

Re: Button effects

Hi @Sienna

 

Yes, that's a good answer. But is this what you meant to say?

 

--------------------------------------------

 

In your OnSelect property of button add

 

UpdateContext({pressedButton:!pressedButton})

 

Change Fill property to

 

If(pressedButton=true, Color.Black, Color.Red)

 

 

Highlighted
Memorable Member
Memorable Member

Re: Button effects

Hi @timl

Yes.. Thanks for correction... I wanted to do it old way at first and then I've changed my mind 🙂

Highlighted
Super User
Super User

Re: Button effects

No problem @Sienna! It was pretty obvious what you were getting at, but I thought I'd mention it just in case.

Highlighted
Memorable Member
Memorable Member

Re: Button effects

That is ok... Please always do if you spot some misstake. I usually do this on the go or while I'm waiting for PA to start responding again 😞

Highlighted
Helper IV
Helper IV

Re: Button effects

Thanks very much.   This works but I have several different buttons on the same page.   I used these formulas for each but when I press one button it changes all of them black.   I know I need to specify the name of the particular button somewhere in there but I don't know where.

Highlighted
Memorable Member
Memorable Member

Re: Button effects

You'll have to do it change variable buttonPressed on each button 

 

buttonPressed1

buttonPressed2

.

.

.

View solution in original post

Highlighted
Helper IV
Helper IV

Re: Button effects

@Sienna  Thank you!   This worked perfectly!

Highlighted
Frequent Visitor

Re: Button effects

I was able to get buttons to change the Fill but when clicked a second time the button reverts back to its original state, like a toggle.

So when one button gets clicked I am filtering a gallery based on a Status field, and that button should stay highlighted while on that view, but if the same button gets clicked again it goes back to a white (orginal) Fill.

 

Is there a way to make it not toggle?

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,198)