Hi,
I have a gallery of texts and a button, each time i add an element to the gallery, i have a new text added to the gallery with a new button, the thing is I want to change the color of the text when i click on the specified button, but when i do, all the texts change color, so how can i link the button to its related text ?
Thank you, i hope i have been clear
Solved! Go to Solution.
Hi @Anonymous ,
In the OnVisible property of the Screen, set a variable Set(varTextColor, false).
In the OnSelect property of the Button, update the variable UpdateContext({varTextColor: !varTextColor})
In the Color property of the Text Control, If(ThisItem.IsSelected && varTextColor, Red, Black)
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.
Hi @Anonymous ,
Can you please share some screenshots and formulas that you are currently using? Based on the explanation you have provided, it would seem that you are using a Gallery control. You can set the text color for the control in the "OnSelect" property of Button control for the row.
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.
Hi @Anonymous
You need to have two properties to make sure only the the selected item color changes. So, the logic is something like "If this item is selected and the Button is pressed, make the text Red, otherwise make the text Black".
As @pawanjajoo has said, you haven't given enough information to be accurate but the code in your Color property of the text would be something like 'If(ThisItem.IsSelected && Button1Pressed = true, Red, Black)'
Yes I have a gallery control with rows, and each time someone add a new element through forms, a new row is created, but when i want to change the color of the text of the row with its related button ( in the same row ), all the texts change color.
On the button select part I'm using : UpdateContext({var: RGBA(255,255,0,100)})
and on the text fill part i have : var
Hi @Anonymous ,
As mentioned by @LooseChippings , you need to use If condition to ensure that the variable is applied only to selected item. Since you have not applied any condition, on click of button, it is updating the color for all the rows.
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.
But I only click on the button, the text is not selected, is it alright ?
Hi @Anonymous ,
Yes, that's all right. You don't need to select the text. ThisItem.Selected just refers to that particular row in the gallery.
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.
My button name is " NextArrow1 ", so what i need to do is to write on the color part of the text : If(ThisItem.IsSelected && NextArrow1 = true, Red, Black)' ? Should I add some code on the button too ?
Im sorry im really new to all of this so im not sure what to do
Hi @Anonymous ,
In the OnVisible property of the Screen, set a variable Set(varTextColor, false).
In the OnSelect property of the Button, update the variable UpdateContext({varTextColor: !varTextColor})
In the Color property of the Text Control, If(ThisItem.IsSelected && varTextColor, Red, Black)
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.
It works, but I press the other button, the color of the other row go back to normal. Do you know how to fix it ?