cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bouillons
Helper V
Helper V

How to make the text in a text box selected from a button ?

Hi,

 

I have a few simple fields for display only, and one of them is for a quantity. When the user clicks an Edit button, I want allow the user to update the items, and to position the cursor on the quantity field (this I know how to do), but WITH THE TEXT IN THE FIELD SELECTED, so that when the user types, the quantity is immediately replaced with the new value. The solution I have now requires the user to first delete the quantity before starting to type.

 

Using SetFocus(txtQuantity) places the cursor behind the quantity value:

 

bouillons_0-1595779527622.png

 

This is what I want:

bouillons_1-1595779616037.png

 

I tried the Select command, but it does nothing for a text box.

 

Thanks for any pointers,

Stephane

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi@bouillons,

Based on the issue that you mentioned, do you want to direct entry in the TextInput on selecting the button?

Currently, make Text selected and entry to replacing the previous entries cannot be achieved in PowerApps. As an alternative solution, you can try the following workaround.

I have a test on my side, please take a try as below.

1/ Add a TextInput 

2/ Add a Button and set the OnSelect property as below.

 

If(
    !IsBlank(TextInput1),
    Reset(TextInput1)&&
    SetFocus(TextInput1)
)

 

Best Regards,

Qi

 

Best Regards,
Qi

View solution in original post

3 REPLIES 3
mdevaney
Super User
Super User

@bouillons 

Put this code in the Default property of the control.  When you change it to edit mode it will become blank.

 

If(TextInput_Aantal.DisplayMode=DisplayMode.Edit, Blank(), ThisItem.your_column_name)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

v-qiaqi-msft
Community Support
Community Support

Hi@bouillons,

Based on the issue that you mentioned, do you want to direct entry in the TextInput on selecting the button?

Currently, make Text selected and entry to replacing the previous entries cannot be achieved in PowerApps. As an alternative solution, you can try the following workaround.

I have a test on my side, please take a try as below.

1/ Add a TextInput 

2/ Add a Button and set the OnSelect property as below.

 

If(
    !IsBlank(TextInput1),
    Reset(TextInput1)&&
    SetFocus(TextInput1)
)

 

Best Regards,

Qi

 

Best Regards,
Qi

Thanks Qi for your time and effort, that's a good enough workaround for my scenario for the time being.

Stephane

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,305)