cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
helpneeded1
Helper III
Helper III

Button pressed to button selected

Hi! How can I have a button in Power apps that keeps the selection after pressed. I mean that when I press the button it is active, not like when I press the button it will be active only while pressing?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
iAm_ManCat
Super User
Super User

This is what we use Toggles for - you toggle it to turn it on, then toggle it again to turn it off.

 

If you don't want to use the in-built toggles, you could re-create the functionality with a button and a variable - set the variable like this:

Set(gblThisButtonName_Status, !gblThisButtonName_Status);

That way it will set it to false if true and true if false - then have your border, fill and other values on the button rely on that variable for their colour like:

If(gblThisButtonName_Status, Green, RGBA(125,125,125,1));

 

If that seems like a lot of effort then probably best to use the defautl toggle that you can insert from the editor,

Hope this helps!

 

Cheers,

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

5 REPLIES 5
phipps0218
Super User
Super User

What do you mean active only while pressing?

I mean that if i press the button it will lock the selection not only temporary activate the button.

iAm_ManCat
Super User
Super User

This is what we use Toggles for - you toggle it to turn it on, then toggle it again to turn it off.

 

If you don't want to use the in-built toggles, you could re-create the functionality with a button and a variable - set the variable like this:

Set(gblThisButtonName_Status, !gblThisButtonName_Status);

That way it will set it to false if true and true if false - then have your border, fill and other values on the button rely on that variable for their colour like:

If(gblThisButtonName_Status, Green, RGBA(125,125,125,1));

 

If that seems like a lot of effort then probably best to use the defautl toggle that you can insert from the editor,

Hope this helps!

 

Cheers,

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


I agree with @iAm_ManCat that this is what a toggle is for hence my original confusion. 

helpneeded1
Helper III
Helper III

Thanks for the help @iAm_ManCat and @phipps0218! I got it to work.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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