CRM Crate

Improve user experience with SetFocus function in Power App

We will learn to improve user experience with SetFocus function in Power App. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Apps.

Improve user experience with setFocus function in Power App

What is Power FX?

Microsoft’s Power Fx is the low-code language that will be used across Power Platform. It’s a strong-typed, general-purpose, declarative, and functional programming language. Power Fx is expressed in user-friendly text. It’s a low-code language that citizen developers & makers can work with directly in an Excel-like formula bar or Visual Studio Code text window.

It enables a complete range of development from no-code for those who have never programmed before to “pro-code” for the seasoned professional, with no learning or rewriting cliffs in between, enabling diverse teams to collaborate and save time and expense.

setFocus function in Power App

Understanding SetFocus() function in Power Apps

The SetFocus is used to move an input focus to a specific control. The user’s keystrokes are then received by that control, allowing them to type into a text input control or use the “Enter” key to select a button. The user can also use the “Tab” key, touch, mouse, or other gesture to move the input focus themselves. “Tab” key behaviour is governed by the TabIndex property.

When should we use SetFocus function?

Use the function for the below given applications:

  • a screen is displayed, to focus the first input control with the OnVisible property of the Screen.
  • a newly exposed or enabled input control, to guide the user in what comes next and for faster data entry.
  • a form is validated, to focus and display the offending input control for quick resolution.

What are the limitations of SetFocus function?

This function can be used with the below given components:

Syntax

SetFocus (Control)

The SetFocus function gives a control the input focus. 

Implementing SetFocus function in Canvas App

In our scenario, we have added three different SetFocus controls during the “OnChange” property of input toggle control. This will dynamically focus the required control as per the user input.

If(UAN_Toggle.Value = true, SetFocus(UAN_Input))
If(PAN_Toggle.Value = true, SetFocus(PAN_Input))
If(Employee_Toggle.Value = true, SetFocus(JobID_Input))

Thus, we learned to improve user experience with SetFocus function in Power App.

5 1 vote
Article Rating
Subscribe
Notify of

0 Comments
Inline Feedbacks
View all comments
error: CRM Crate Security Engine - Disabled Right Click & Selection!

Congratulations!

Well Done,
Welcome to CRM Crate

Stay tuned with us and get all latest updates and learning in Microsoft CRM and related techonologes.