
Introduction to OnSelect
OnSelect is one of the most common properties that a lot of the controls have. It defines what needs to happen when a user clicks on a control. To learn more about controls and their properties, click here.
OnSelect within a gallery
The gallery control also has an OnSelect property. Typically, when you add a clickable control, say a button, inside a gallery, its OnSelect is set to Select(Parent) which simply means that clicking on the button will do the same thing as clicking anywhere in the gallery.
In one of the apps I was building recently, for some reason, I had the button's OnSelect set to the same code as that of the gallery. And that code was not working. I kept making changes to the OnSelect of the gallery since I never change the OnSelect of a clickable control inside a gallery. After spending a few hours trying to figure out why my code changes are not making any difference, I figured that since the button had its own code, making changes to the OnSelect of the gallery wasn't doing anything. Every time I clicked on the button, the button's code was getting used.
So if there is a clickable control, say a button, inside a gallery, and the OnSelect of that button is not set to Select(Parent), the code in its OnSelect will take precedence when that control is clicked.
Here is a quick demo:

1 thought on “OnSelect – how to use for a clickable control in a gallery”