封装inputBox控件的文本修改方法

This commit is contained in:
MrZ626
2021-05-13 19:48:07 +08:00
parent 38326bc3b6
commit 85e6810f99
5 changed files with 40 additions and 22 deletions

View File

@@ -742,6 +742,24 @@ function inputBox:reset()
kb.setTextInput(true)
end
end
function inputBox:hasText()
return #self.value>0
end
function inputBox:getText()
return self.value
end
function inputBox:setText(str)
if type(str)=='string'then
self.value=str
end
end
function inputBox:addText(str)
if type(str)=='string'then
self.value=self.value..str
else
LOG.print("inputBox "..self.name.." dead, addText("..type(str)..")",'warn')
end
end
function inputBox:clear()
self.value=""
end