I'm creating a project in PowerApps. I need help with one functionality. I want the button and pressing the Enter key on the keyboard to perform the same action.
I am a complete beginner, I don't know how to deal with it. This is my code:
` loginScreen As screen: BackgroundImage: =bg1k ImagePosition: =ImagePosition.Fill OnVisible: | =Set(labeltxt,false); Set(lblview, TextMode.Password);
Container1 As groupContainer.manualLayoutContainer:
DropShadow: =DropShadow.ExtraBold
Fill: =RGBA(255, 255, 255, 1)
Height: =600
RadiusBottomLeft: =10
RadiusBottomRight: =10
RadiusTopLeft: =10
RadiusTopRight: =10
X: =450
Y: =63
ZIndex: =1
personalNumbertxt As text:
BorderThickness: =1
Default: =""
Height: =60
HintText: ="Enter your personal number here"
OnChange: |
=
OnSelect: =Set(labeltxt,false)
PaddingBottom: =20
PaddingLeft: =35
PaddingTop: =20
RadiusBottomLeft: =0
RadiusBottomRight: =0
RadiusTopLeft: =0
RadiusTopRight: =0
Width: =447
X: =28
Y: =154
ZIndex: =1
pintxt As text:
BorderThickness: =1
Default: =""
Height: =60
HintText: ="Enter your PIN code here"
Mode: =lblview
PaddingLeft: =35
RadiusBottomLeft: =0
RadiusBottomRight: =0
RadiusTopLeft: =0
RadiusTopRight: =0
Width: =450
X: =28
Y: =251
ZIndex: =2
loginFormlbl As label:
Align: =Align.Center
FontWeight: =FontWeight.Bold
Height: =50
Size: =24
Text: ="Login Form"
Width: =450
X: =25
Y: =50
ZIndex: =3
incorrectlbl As label:
Align: =Align.Center
Color: =RGBA(118, 0, 0, 1)
Height: =59
Size: =11
Text: ="Incorrect personal number or PIN!"
Visible: =labeltxt
Width: =450
X: =25
Y: =371
ZIndex: =4
loginbtn As button:
Height: =43
OnSelect: |
=Set(
userrolevalue,
LookUp(
loginns,
'Personal number' = personalNumbertxt.Text And PIN = Value(pintxt.Text)
)
);
If(
IsBlankOrError(userrolevalue), //ak neplatí
Notify("Incorrect Username or Password");
Set(labeltxt, true),
Navigate(categoryScreen) //ak platí
);
Reset(personalNumbertxt); //po overení užívateľa!! čiže akokoľvek
Reset(pintxt);
RadiusBottomLeft: =5
RadiusBottomRight: =5
RadiusTopLeft: =5
RadiusTopRight: =5
Text: ="Login"
Width: =239
X: =130
Y: =456
ZIndex: =5
iconUser As icon.AddUser:
Color: =RGBA(102, 102, 102, 1)
Height: =60
Icon: =Icon.AddUser
PaddingLeft: =7
Width: =25
X: =28
Y: =154
ZIndex: =6
iconView As icon.View:
Color: =RGBA(128, 128, 128, 1)
Height: =36
Icon: =Icon.View
OnSelect: =Set(lblview,TextMode.SingleLine)
PaddingRight: =10
Width: =36
X: =426
Y: =263
ZIndex: =7
iconLock As icon.Lock:
Color: =RGBA(128, 128, 128, 1)
Height: =60
Icon: =Icon.Lock
PaddingLeft: =7
Width: =25
X: =28
Y: =251
ZIndex: =8
`
Unfortunately, "Enter key" functionality is not supported in Microsoft Power Apps by default.
There are few workarounds to get it working as mentioned in this thread, Power Apps - Submit Form with the Enter Key:
Source: Create accessible canvas apps