0

如何清除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以便我有空间评论另一个。我怎么做?

4

2 回答 2

2

textField->resetText()

文档在这里:

http://developer.blackberry.com/cascades/reference/bb__cascades__textfield.html

于 2013-07-24T15:22:41.807 回答
1

onSubmitted处理程序中试试这个:

tfComment.Text = ""
于 2015-04-18T03:26:41.747 回答