Re: Date OnSelect make a label visible
To simplify if you need to add more and more galleies, try the reverse.
- Create a global variable to cross screens on the first screen's OnStart: UpdateContext:({Gallery1LabelVisible:false})
- For the screen with the gallery button or label. Edit the OnVisible: UpdateContext:({Gallery1LabelVisible:false}). ( Assuming you want the Galley and the external button on the same screen. If they are on different screens, you will have to remove that OnVisible code.
- For the button or Label outside of the gallery. Edit the Text field to: If(Gallery1LabelVisible=false,"Gallery item UnSelected","Galley item Selected") etc. To trigger the label in the gallery If(Gallery1LabelVisible=false, UpdateContext:({Gallery1LabelVisible:true}),UpdateContext:({Gallery1LabelVisible:false}). Now if you click the external button, and then a gallery item, text will appear.
- For the button that you can add in the galley. Go for full width with Parent.Width. Then you can use that as a label and a button. For its Text field: if(ThisItem.IsSelected&&Gallery1Label=true,"IsSelected text","IsUnSelected text"). Then go for the OnSelect: If(Gallery1LabelVisible=false, UpdateContext:({Gallery1LabelVisible:true}),UpdateContext:({Gallery1LabelVisible:false}). To toggle this effect add the same code that you used on the external button. OnSelect: If(Gallery1LabelVisible=false, UpdateContext:({Gallery1LabelVisible:true}),UpdateContext:({Gallery1LabelVisible:false})
That will do somethign like the following.
If an item in the galley is not selected It will present false text on a label anywhere due to a global variable.
If an item in the gallery is selected the text in both the gallery and the external label will produce true text.
Some things to think about.
Galleries depending on your filter rules and the default rule will always have something selected.
If you are using multiple screens you need a global variable.
You can have a toggle efeect.
You can create a simple variable instead of multple UpdateContext for each item. Then add if statements on the controls. For example: Visible: If(GlobalVariable=true,true,false). Size: If(GlobalVariable=true,21,16) X or Y: If(GlobalVariable=true,88,400)