cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver II
Resolver II

Select Label Text on focus

Thank you for taking the time to read my question.

 

Is it possible to select the value that already exists inside a label or a Text Input when it receives the focus? 

 

On my Screen I have a drop down. When the user selects a value from the drop down I set the focus to my label. The Label's Text value is a Lookup, so I want to select the returned value when the label receives the focus.

 

Thanks!

 

 

12 REPLIES 12
Highlighted
Resolver III
Resolver III

hi there not too sure what it is you trying to achieve. when you select the dropdown value, the "focus" is still on the dropdown whic selected you assign to a variable and have that reflect in the label or use that to lookup a value and set the return value to the label. either way you will have the returned value. maybe if you can give some screenshots of what you want to achieve it will be great. tnx

Highlighted

Thank you for your reply. Sorry I was not very clear.

 

I'll try to explain using steps:

1. User selects value from DropDown

1a. DropDown OnChange = SetFocus(Label1)

2. Label1.Text = Lookup(based on DropDown value selected by user)

 

Therefore, once the user makes a selection in the DropDown, Label1 value is set and Label1 receives the focus. Since it is not possible to copy a value to the clipboard (using app on PC only) I was hoping to pre-select the value for the user so all they have to do is Ctrl+C to copy saving them a bit of mouse or keyboard work to select the Label1 value.

 

Better? 🙂

Highlighted

You can achieve this with 2 functions: 

  1. Add a button and its on OnSelect, have Set(testVar, Lookup(based on DropDown value selected by user))​
  2. I would probably use a Text Input control than a label or what you can do is have a text input control hidden behind the label. - ​Have the text property of the text input control and the label set to testVar
  3. In the OnChange of your drop down, have this code: Select(Button); SetFocus(TextInput)​

This should work. I will test it real quick and let you know if it works. If you get to test it before I do, let me know. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Highlighted

hi there, better now i understand thank you. im with @PowerAddict on this one. remember the input vs label.

Highlighted

You can make it slightly easier. Here is another set of things that you can do to make this work: 

  1. Add a button and have its Text property set to testVar​
  2. I would probably use a Text Input control or a button than a label and set its text property to testVar
  3. In the OnChange of your drop down, have this code:  Set(testVar, Lookup(based on DropDown value selected by user))​; SetFocus(TextInput)​

The reason for using Text Input control or a Button is because the focus will set on these controls and will be visible rather than on a label. Here is a quick demo: 

Focus.gif 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Highlighted

If you liked my replies, please give kudos (Thumbs Up). And if any of them solved your problem, please mark that reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Highlighted

Hi,

 

Thank you both for the replies. I've been reading and re-reading them....

 

I can do what the gif shows already... I think, unless I'm missing something.

 

You know when you're filling in a form on a web site and there are pre-populated values in some fields? Then when you click on a field, the pre-populated value is selected so that if you start typing the pre-existing value is overwritten?

 

I want to select the value in the label or textinput when the label or textinput receives the focus.

 

TEST.gif

This is a form I found on the internet. The form flow is backwards but it shows what I mean. The focus moves from the yellow drop down to the Text: field. When I do a Shift+Alt+Tab the focus move up to the Text: field and the value that is existing in the text box is selected.

 

Therefore, in my app I want to select a value from my dropdown. Once I do that, the lookup sets the value of my label and then the focus is set to the label. When the label receives the focus I would like the value to be selected just like "Test" is selected in the gif above.

 

Am I doing any better explaining? I hope so. Thank you for your patience.

 

 

Highlighted

Awesome explanation, thank you for that!

 

One question I have is say when the label/text input control has the text "Test" written on it (from the example in the video), is there a possibility that the user doesn't update that value? Or the user will always have to type in something and update that Test to some other text? 

 

If the user is always supposed to update that, you can achieve something similar by simply setting the text input control's Hint Text property in my suggested solution. Although when the focus is set to that text input control, the text would be blank. 

 

I am not sure if we can achieve exactly what you want, but I will definitely try it out in some time and will get back to you. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

 

Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
https://thepoweraddict.com

Highlighted

Thanks again for your reply.

 

Hint Text will not work. I want the users to be able to select the text.

 

If you're curious to try and figure it out, great! But don't spend too much time on it. My users can just select the value in the label and then copy it. I was just hoping to save them a step.

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,344)