我正在 PowerApps 中创建一个项目。我需要一项功能的帮助。我想要按钮和按键盘上的 Enter 键来执行相同的操作。
我是一个完全的初学者,我不知道如何应对。 这是我的代码:
` 登录屏幕作为屏幕: 背景图片:=bg1k 图像位置:=ImagePosition.Fill 可见: | =设置(labeltxt,假); 设置(lblview,TextMode.密码);
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
`
不幸的是,默认情况下,Microsoft Power Apps 不支持“输入键”功能。
有一些解决方法可以使其正常工作,如本线程中所述,Power Apps - 使用 Enter 键提交表单:
您可以先多次按“Tab”键,直到选择“提交”按钮,然后按“Enter”触发此按钮并提交表单。
Tab 键应按逻辑顺序导航至交互元素。您可以使用逻辑应用程序结构并相应地设置每个控件的TabIndex属性来创建它。
来源:创建可访问的画布应用程序