【问题标题】:Implement data change listener in a dialog box form以对话框形式实现数据更改监听器
【发布时间】:2015-01-30 01:52:52
【问题描述】:

我已经在一个表单上实现了一个数据更改监听器,它工作得很好,但是当我尝试在一个对话框中的表单上实现它时,它似乎不起作用。可能是什么问题?这是我的代码...

protected void onMain_AddMemberAction(final Component c, ActionEvent event) {

    //Show the dialog box that has the form.
    final Dialog d = (Dialog)createContainer(fetchResourceFile(), "GUI 1");
    d.show();
    //Listen to the data change on the text field.
    findPostalCode(c).addDataChangeListener(new textListener() {
      public void dataChanged(int type, int index) {
        //Run the following method  
         test(c); 
      }
  }); 

}

private abstract class textListener implements DataChangedListener {

}

提前谢谢你

【问题讨论】:

    标签: dialog textfield addeventlistener codenameone


    【解决方案1】:

    show 是一种阻塞方法,因此您的侦听器仅在对话框被释放后才注册。使用showModless

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-07
      • 1970-01-01
      • 2016-04-14
      • 1970-01-01
      • 1970-01-01
      • 2017-12-19
      相关资源
      最近更新 更多