cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AchSoWas
Level: Powered On

Change Label,Text, Image

Hello
If I press on a button I would like:

 

1. Change the label text
2. Give the text field a new text.
3. Assign another image to the control

 

How does it work ? Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
SnowFlake
Level: Powered On

Re: Change Label,Text, Image

Apologies guys I have solved it, Set(ButtonText,"Today") on each button go do the same thing for onselect, Set(ButtonText, "Tomorrow") and so on, then go to text field you want the label to show and just type ButtonText. 

 

I was over thinking it. 🙂 

 

Enjoy the rest of your day.

View solution in original post

6 REPLIES 6
Power Apps Staff AKotb
Power Apps Staff

Re: Change Label,Text, Image

You can try Context Variables,

 

Basically Change the OnSelect property of the button to be something like

 

UpdateContext({pressed: true})

Then the Label Text Propety of the label can be something like this

If(pressed = true, "value1", "value2") 

 

Then the Label Default Propety of the text field can be something similar to the above one as well

If(pressed = true, "value1", "value2") 

 

and we can use the a similar formula for image as well by setting the Image Propety to :

If(pressed = true, Image1.Image, Image2.Image) 

 

 

SnowFlake
Level: Powered On

Re: Change Label,Text, Image

Hi Guys

 

Thanks for all your help, This forum always has the answers im looking for. however I am trying to have a button.text update to multiple different text inputs.

For example:

I have a gallery filtering "today" Tasks, I have made show today using onselct UpdateContext({pressed:true}) and text field is If(pressed=true,"Today","") Works perfectly with true false.

 

How would I have button.text change with other buttons to, "Today", "Tomorrow", "Yesterday"... more than 2 changes?

 

Any help would be appreciated

thank you most kindly

SnowFlake
Level: Powered On

Re: Change Label,Text, Image

Apologies guys I have solved it, Set(ButtonText,"Today") on each button go do the same thing for onselect, Set(ButtonText, "Tomorrow") and so on, then go to text field you want the label to show and just type ButtonText. 

 

I was over thinking it. 🙂 

 

Enjoy the rest of your day.

View solution in original post

Corbie
Level: Powered On

Re: Change Label,Text, Image

@AKotb 

 

Hello,

 

i have problem this syntax: If(pressed = true, "value1", "value2")

 

dont work for me now in 2019 was there any changes or somethin like that?

im getting error:  it contains error ParenClose where error is expected.

 

Thanks for answer,

 

John

SnowFlake
Level: Powered On

Re: Change Label,Text, Image

Hi @Corbie 

 

Could you show the syntax you using or a screenshot and I can assist further? 

 

If it is complaining about a parenClose make sure you have all your syntax-correct with "(" ")" and "{" "}" if they are needed.

Corbie
Level: Powered On

Re: Change Label,Text, Image

@SnowFlake 

 

Hello,

 

I figure it out: It was cause of differen language in browser.

 

Thanks for answer anyway.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (6,431)