修正文本框控件长度限制判定问题

This commit is contained in:
MrZ626
2021-10-18 00:18:50 +08:00
parent 820b555924
commit fd3b187d32

View File

@@ -922,6 +922,7 @@ function WIDGET.newInputBox(D)--name,x,y,w[,h][,font=30][,secret][,regex][,limit
font= D.font or int(D.h/7-1)*5,
secret=D.secret==true,
regex= D.regex,
limit= D.limit,
hideF= D.hideF,
hide= D.hide,
}
@@ -1426,7 +1427,7 @@ end
function WIDGET.textinput(texts)
local W=WIDGET.sel
if W and W.type=='inputBox'then
if(not W.regex or texts:match(W.regex))and #texts<=W.limit then
if(not W.regex or texts:match(W.regex))and(not W.limit or #(WIDGET.sel.value..texts)<=W.limit)then
WIDGET.sel.value=WIDGET.sel.value..texts
SFX.play('move')
else