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

SetFocus on first screen

Hi,

I try to focus the first field on a screen with SetFocus but it don't work. This probleem only exists for me on the first screen when I open the app. In all other cases SetFocus is working very well.

I used the SetFocus function in the Onvisible trigger of the screen.

 

Thanks.

 

Marcel Vos

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @marcelvos ,

Could you please share a bit more about the "field" you want to focus on?

Is the "field" existed within the Screen or within a Gallery?

 

Currently, there are some known limits with SetFocus() function. Please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-setfocus#limitations

 

The SetFocus function could only be applied to Button, Icon, Image, Label and TextInput control. And these controls could not be in a Gallery control, Edit form control, or Component.

 

Please make sure the "field" you want to set focus on is not existed within a Gallery control, Edit form control, or Component. You could add a scrollable screen in your app, the SetFocus can be used with a control in a scrollbale screen.

 

Please set the OnVisible property of the screen to following:

SetFocus(TextInputControl)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

12 REPLIES 12
Highlighted
Super User
Super User

Try Select()

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

Highlighted

Thanks.

We tested this but it gives the same issue. Focus on a field on startup of the app is not working. Are there some other tricks?

Highlighted

Is SetFocus() the last (or only) function in the OnVisible property?

Highlighted

Hi Eric,

 

It was the last function. Before SetFocus I used the set function. Now I moved the SetFocus before the Set function without any result.

Do you think that other functions gives problems with SetFocus? I'am no longer with the customer but tuesday I can test this with the customer's scanner.

 

I let you know the test results. Thank you in advance.

 

Greeting, Marcel

Highlighted

I'm not sure exactly. I did a test on my end and was able to focus on a text input using SetFocus() in the OnVisible property. There seems to be something interfering with yours but I'm not sure what it would be..

Highlighted
Community Support
Community Support

Hi @marcelvos ,

Could you please share a bit more about the "field" you want to focus on?

Is the "field" existed within the Screen or within a Gallery?

 

Currently, there are some known limits with SetFocus() function. Please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-setfocus#limitations

 

The SetFocus function could only be applied to Button, Icon, Image, Label and TextInput control. And these controls could not be in a Gallery control, Edit form control, or Component.

 

Please make sure the "field" you want to set focus on is not existed within a Gallery control, Edit form control, or Component. You could add a scrollable screen in your app, the SetFocus can be used with a control in a scrollbale screen.

 

Please set the OnVisible property of the screen to following:

SetFocus(TextInputControl)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

Hi,

 

Thanks for your answer.

The field is a text field. I used a empty screen. See image for more details.

 

2020-01-17_08-47-19.png

Highlighted
Dual Super User III
Dual Super User III

Hi @marcelvos 

 

Can you try to Set focus on the "OnStart" property of the App? It will be triggered whenever the app is opened/refreshed.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Highlighted

Hi @marcelvos ,

 

Are you working on Apple iOS?

See, SetFocus explained :

"On Apple iOS, the soft keyboard will only be displayed automatically if SetFocus was initiated by a direct user action. For example, invoking from a button's OnSelect property will display the soft keyboard while invoking from a screen's OnVisible will not."

 

I just tested this, indeed it is working if SetFocus was initiated by a direct user action and not from a screen's OnVisible. Also, tested this on my mobile, then it is working from the screen's OnVisible.

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 (9,438)