Skip to content

Commit

Permalink
修正文本框控件长度限制判定问题
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Oct 17, 2021
1 parent 820b555 commit fd3b187
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Zframework/widget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fd3b187

Please sign in to comment.