cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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
Highlighted
Advocate II
Advocate II

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
Highlighted
Power Apps
Power Apps

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) 

 

 

Highlighted
Advocate II
Advocate II

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

Highlighted
Advocate II
Advocate II

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

Highlighted
Helper I
Helper I

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

Highlighted
Advocate II
Advocate II

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.

Helper I
Helper I

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,134)