2
votes

I have a from in PowerApps with labels and textboxes. By default textboxes are empty. There is a Button named "Copy last row" when use will click on this button some sample values should be displayed in textboxes.

I checked on internet and the following solution was suggested by PowerApp support.

You need to set the text box' text property to this:

 If(HasBeenPressed, "Hello", "GoodBye")  

You also need to set the button's onselect property to this:

UpdateContext({HasBeenPressed: true})

or for more fun,

UpdateContext({HasBeenPressed: !HasBeenPressed})

But when I go to the properties of my textbox there is no such property like 'TEXT'.

2
Could you provide any code or something? Please see stackoverflow.com/help/how-to-asknonNumericalFloat

2 Answers

3
votes

What do you mean by textbox? a label or a text-input?

Anyways, Label has a text property: enter image description here

Text-input has a default property enter image description here

I'm afraid u can't change the text directly. What u can do is create a context variable in the property "OnVisible" of your screen and give the default text you want your labels to have in the first place, or leave the variable in blank since you want them to have no text:

On visible context variable enter image description here

Then, set the text property of your label to be the value inside the variable enter image description here

Or the default property of your text-input enter image description here

Last but not least, set the OnSelect property of your button to change the value of your variable: enter image description here

This is the result: enter image description here

Hope this helps!

2
votes

Adding clarifications on top of Bruno's demonstrating answer.

In Canvas PowerApps, both Label & Text input controls have the Text property.

But Text is Output only property for Text input control whereas for Label its of both type ie. input and output property. People (bloggers/trainers) often mix these controls & properties.

enter image description here

Text is an Output property on that control, to be consumed by other controls. You can't set it manually as it is not an Input property. The Default property determines its initial content.

by PowerApps staff on PowerApps forum