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

Multiple buttons to stay focused

Hello,

I have a screen that has four questions, each question has 5 possible answers.

I am using buttons for the answers.

The problem I have is the button selected for each question doesn't stay "focused", the focus it always with the last pressed button.

I have tried grouping buttons together but that didn't seem to make any difference.

Is it only possible to have one button per screen be in the 'focused' mode?

Is there a control that would be more suitable for this?

Thanks

Rosie

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

@Rosie 

Yes, as @WarrenBelz  suggests, you need to change the properties of the controls you have based on your conditions.  You cannot set them from a formula directly, they have to gain their value from a formula.  So, in this case, you would be looking at the Fill properties, the BorderColor properties, etc and place your formula there. 

 

This is a bit easier to demonstrate than describe. 

I have attached an app (save it to your computer, then in the PowerApps designer, File->Open and browse for the file).
Once open, click on the "Run OnStart" under the elipse menu on the App (I needed to do what I did to demonstrate in a collection and it gets filled in on the OnStart)

 

Take a look at it and specifically look at the Fill, and OnSelect properties of the buttons in the gallery.

I did not know about your data in this case, so I just threw some things together for it.

But again, the real core of this comes in the Fill and OnSelect properties.

 

Let me know if you have any questions on it and I hope it is clear for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

14 REPLIES 14
Highlighted
Super User III
Super User III

Hi @Rosie ,

Have a look at the SetFocus function - and also the Tab Index property.

Happy to help further.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted

Hi @WarrenBelz ,

Thanks for your suggestion.  I did come across that but the examples didn't quite fit and I wasn't sure how that could be used.

It appears to need a specific control and I don't know which one the user is going to click.

If you would be able to provide a bit more explanation that would be appreciated.

 

Many thanks

Rosie

Highlighted

Thanks @Rosie ,

Can you please send a screen shot so I can get more of a grasp of your requirements.

Also would you consider simply having different border or text colours on the ones you want focussed.

Highlighted
Super User III
Super User III

@Rosie 

If the SetFocus and Tab options doesn't help, can you provide a little more about what formulas you are using to try and achieve this effect?  Also, perhaps a screen shot to better understand what you are seeing.

In general though, no, you cannot have multiple buttons focused at the same time, but I don't believe it is the focus that you want as much as the "appearance" of focus that you want.  Similar to a checkbox - for these 4 questions check one of the 5 possible answers.

 

I hope this helps guide you a bit.  If not, just post back more.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Highlighted

Hi @WarrenBelz , @RandyHayes ,

Something happened to the screenshot I uploaded on the initial post.

Randy you are correct, it is the appearance.

I user would select one option from each row, only one option in each row can stay highlighted.

Each button has a formula that defines a numeric value, this works perfectly if they change their mind and click a different button in the row, the numeric value will change:

UpdateContext({ShiftMaxHours: "2"})

 

Thanks

Rosie

Highlighted

Hi @WarrenBelz ,

I have colours defined for the FocusedBorderColor.  But when a second button is clicked it has the FocusedBorderColor the first button doesn't have the FocusedBorderColout anymore.

 

Rosie

Highlighted

@Rosie 

Yes, I would ditch the Focused concept for this.  You'll not be able to have more than one item focused.

Instead consider changing the colors or borders or other properties to distinguish a selected answer.

 

If you need some more help on that, post back.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Highlighted

 

Thanks @Rosie ,

As mentioned, have you considered simply having a different BorderColor on the buttons you want “focussed”.

 

 

If( WhateverCondition, Red, YourButtonName.Color )

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted

Hello,

I would like to be able to get the border colors to stay a certain colour but this is the bit I don't know how to do.

I do not have a lot of coding experience so I am struggling with how to achieve that.

 

@WarrenBelz  has suggested this: 

If( WhateverCondition, Red, YourButtonName.Color )

Which makes sense but I am not sure how to use this.

I have tried:

Onselect

If(btnMaxHrs43 = 1, Green, btnMaxHrs43.green)

I get errors with this.

How do I write If(button1 is selected, fill color Green, fill colour white)  is this the right approach?

 

Thanks

Rosie

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (14,368)