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

How do I select a button in a gallery programmatically?

Hi Folks,

I have an app with a gallery of buttons I am using to make a tabbed form. In the browse tab, I have a regular vertical gallery called BrowseGalleryTab. When I select the NextArrow on an item, I do not need to navigate per se since I am not leaving that screen. I just want to have the app change the tab (button) selection in the TabGallery. The BrowseGallery is visible when the TabGallery button "Browse" is selected. I want the button labeled "Information" to be selected when the NextArrow is clicked. So far I have successfully caused the correct data to show up on the other tabs by putting "BrowseGalleryTab.Selected" in the Item property of the entity that should be visible on a given tab. I just need to make the NextArrow adjust the gallery selection in the TabGallery. I have included a couple of screenshots for context and clarity.

Tab Problem Screen 01.png

 

Tab Problem Screen 02.png

 

Thanks and regards,

Patrick Kelligan

1 ACCEPTED SOLUTION

Accepted Solutions

Just did a test, it seems the Select isn´t working when triggered from inside of a Gallery. It works perfectly outside of a Gallery from a button. Maybe you can workaround by using a Button that is triggered from NextArrow and uses a variable that is incremented on each click. And you would hide that Button on canvas 

View solution in original post

9 REPLIES 9
Carsten_Growth
Power Apps
Power Apps

You can simply use the select function. 

Select(BreadcrumbGallery, 2, Label)

This would select the second row in your breadcrumb gallery if there´s a label field called "Label" in it.
See attached file

Hi @Carsten_Growth,

Thanks for the speedy response! I have my TabGallery with a button in it and the values in the Items property of the gallery ["Browse","Information","Status","Milestones","Financials","Submit"]. This gives me the repeating tabs in my other screenshot.

I do not have any cards with any fields in it in TabGallery, I tried adding the code below in the OnSelect property of the NextArrow In my BrowseGallery and get an error.

Select(TabGallery,"Information")

Any thoughts?

Thanks and regards,

Patrick Kelligan


I do not have any cards with any fields in it in TabGallery, I tried adding the code below in the OnSelect property of the NextArrow In my BrowseGallery and get an error.

 

Select(TabGallery,"Information")

 

 

Inside your TabGallery you do have items that you´re showing. I am assuming this is done via a Label field. So what you would need is

 

Select(TabGallery, 2, LabelThatHoldsInformationText)

 


2 is for Information or 2nd row

@Carsten_Growth


@Carsten_Growth wrote:

Inside your TabGallery you do have items that you´re showing. I am assuming this is done via a Label field. So what you would need is

 

 

Select(TabGallery, 2, LabelThatHoldsInformationText)

 

 


2 is for Information or 2nd row


No labels in TabGallery. The only control in that gallery is a single button with the Items property set to ["Browse","Information","Status","Milestones","Financials","Submit"]. This gives me the repeating tabs with those values. It ends up looking like this...

Tab Problem Screen 03.png

What I want to accomplish is to select the 2nd position in the array ("Information"). I tied the string below in the BrowseGallery OnSelect property and it did not work.

 

Select(TabGallery, 2, TabButton)

 

"TabButton" is the name of the only control in TabGallery.

 

Thanks for your patience!

Patrick

My understanding was you want to use the NextArrow. So put it inside the OnSelect of the NextArrow, not inside the OnSelect of your Gallery

Thanks, @Carsten_Growth .I had Select(Parent) in the NextArrow and Select(TabGallery, 2, TabButton) in BrowseGallery's OnSelct property. Sorry about that. My mistake.

 

I just put...

Select(TabGallery, 2, TabButton)

 ...in the OnSelect property of the NextArrow control and it does not seem to do anything either. Thoughts?

I would assume it already selected the row. Could you modify the template fill and add something like 

If(ThisItem.IsSelected, Yellow, RGBA(0, 0, 0, 0))

That way you would know if your gallery item row already got selected. If so then you could drill in what should be next action based on this. 

Just did a test, it seems the Select isn´t working when triggered from inside of a Gallery. It works perfectly outside of a Gallery from a button. Maybe you can workaround by using a Button that is triggered from NextArrow and uses a variable that is incremented on each click. And you would hide that Button on canvas 

View solution in original post

EDIT: I got it to work with the hidden button idea. I just put a button up in the header area and called it HiddenButton1, put Select(TabGallery, 2, TabButton) in the new button's OnSelect property and in the NextArrow OnSelect property I put Select(HiddenButton1). That did it. Thanks, @Carsten_Growth!

 

Thanks @Carsten_Growth! That sounds like a good strategy. I am a PowerApps noob though. How would I implement that?

 

-Patrick

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,249)