web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Problem with OnSelect ...
Power Apps
Unanswered

Problem with OnSelect event of itens inside a gallery

(0) ShareShare
ReportReport
Posted on by 9

Hello everybody, I'm setting up a dynamic menu using an array in the OnStart event of my app, and I want that when I click on one of the buttons of my menu the user is directed to a new screen, but every time I click on the buttons a gray bar appears on top of it and does not perform any action. Does anyone have an idea what this is?

 

This is my array: 

ClearCollect(
 arrMenu;
 {
 Car: "Master";
 Plate: "AZK-1765";
 Icon: renault
 };
 {
 Car: "Partner";
 Plate: "RHO-1D14";
 Icon: peugeot
 };
 {
 Car: "Onix";
 Plate: "RHT-8J32";
 Icon: chevrolet
 };
 {
 Car: "Gol";
 Plate: "BCJ-9761";
 Icon: volkswagen
 };
 {
 Car: "Bongo";
 Plate: "BDM-6G86";
 Icon: kia
 };
 {
 Car: "Versa";
 Plate: "BAY-5506";
 Icon: nissan
 }
)

 

And these is my buttons when I press them:

Capture.PNG

 

Categories:
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    What is the code in the OnSelect property for each button?

  • fuba Profile Picture
    9 on at

    I don't have multiple button objects in the gallery, it's just one, as the gallery uses the array as a data base and creates it on the screen as each item is named.

     

    In my OnSelect I only have the basics of the Navigate command

     

    These are my gallery components:

    Capture.PNG

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    I understand, but what does the Navigate command look like?  Normally in this instance you would either need to provide a reference to the screen you want to navigate to in the collection or a Switch that keys off the property of the selected item.  I don't see a reference to a screen in the collection so did you use a switch or a nested if to select where to navigate?

  • fuba Profile Picture
    9 on at

    I see, I used Navigate as follows: Navigate(EditScreen; ScreenTransition.Cover)

    I just tried putting the 'Target' property for my items inside the collection with the value of the screen name 'EditScreen' and replaced it in Navigate, but the bug persists. Not sure if this is what you suggested in your comment above.

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    Do you have a different screen for each auto?  Or is it a single EditScreen, but choosing a specific button should load a particular record in the edit screen?  If its a different screen then you should do something like this

    ClearCollect(
     myMenu,
     Table(
     {
     MenuLabel: "Timesheets",
     MenuIcon: Icon.Clock,
     MenuScreen: TimeEntry,
     MenuID: 1
     },
     {
     MenuLabel: "Projects",
     MenuIcon: Icon.Database,
     MenuScreen: Projects,
     MenuID: 2
     },
     {
     MenuLabel: "Tasks",
     MenuIcon: Icon.Check,
     MenuScreen: Tasks,
     MenuID: 3
     },
     {
     MenuLabel: "Expenses",
     MenuIcon: Icon.Money,
     MenuScreen: Expenses,
     MenuID: 4
     },
     {
     MenuLabel: "Clients",
     MenuIcon: Icon.People,
     MenuScreen: Clients,
     MenuID: 5
     },
     {
     MenuLabel: "Reports",
     MenuIcon: Icon.DocumentPDF,
     MenuScreen: Reports,
     MenuID: 5
     },
     {
     MenuLabel: "Exit",
     MenuIcon: Icon.Cancel,
     MenuScreen: Exit,
     MenuID: 6
     }
     )
    );

     where the menuScreen property has an actual reference to the screen.  If its a single edit form then you need to do something with the choice to tell the form which record to load. 

  • fuba Profile Picture
    9 on at

    Yes, it would be the same screen but the difference is that depending on the car model I select, I change values of two global variables to the values of 'Car' and 'Plate', which are in the collection.

    I also tried to navigate to other screens, without forms, but the result is the same, I click on the button and all I see is this gray line on it, like in the image of the main question

  • fuba Profile Picture
    9 on at

    I just tried something different, I put the Navigate in the OnSelect event of my label, where I have the name of the car and its license plate, and it worked as expected.

    The question that remains is why is there this problem with a button component?

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    if the form is on the same screen then you don't use a Navigate.  In that case the OnSelect for the button should be used to set those two variables based on which button was selected.  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 283

#3
Mohsin Ali Profile Picture

Mohsin Ali 221

Last 30 days Overall leaderboard