如何清除黑莓中的TextField
?这是qml:
Container {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Bottom
leftPadding: 75
rightPadding: leftPadding
bottomPadding: 40
TextField {
id: tfComment
hintText: qsTr("add comment")
inputMode: TextFieldInputMode.Text
input {
submitKey: SubmitKey.Submit
onSubmitted: {
cppObj.onCommentSubmitClicked(tfComment.text, "");
lComment.text = tfComment.text;
}
}
}
}
Container {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Bottom
bottomPadding: 200
leftPadding: 20
rightPadding: leftPadding
Label {
id: lComment
verticalAlignment: VerticalAlignment.Bottom
horizontalAlignment: HorizontalAlignment.Center
text: cppObj.desc
}
}
我想清除输入到TextField
的数据,以便我有空间评论另一个。我该怎么做?
答案 0 :(得分:2)
textField->resetText()
文档在这里:
http://developer.blackberry.com/cascades/reference/bb__cascades__textfield.html
答案 1 :(得分:1)
在onSubmitted
处理程序中尝试此操作:
tfComment.Text = ""