简体   繁体   English

如何在GXT中获取Button

[英]How to get Button in GXT

In my application I have a dialog box, which is not created by it's own class, but just added as a widget to the page. 在我的应用程序中,我有一个对话框,它不是由它自己的类创建的,而是作为窗口小部件添加的。 I need to add a listener to the button in this box, which is added to the dialogue box like this: dialog.setButtons(Dialog.OKCANCEL); 我需要在此框中的按钮上添加一个侦听器,该按钮将被添加到对话框中,如下所示: dialog.setButtons(Dialog.OKCANCEL); Or how to process the button cklick? 或者如何处理按钮cklick?

UPD: I use GXT 2.2. UPD:我使用GXT 2.2。

I've found the way to solve my problem. 我找到了解决问题的方法。 To handle the "ok" button click I needed to do the following: 要处理“确定”按钮,请单击以下步骤:

 addDialog.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
            @Override
            public void componentSelected(ButtonEvent ce) {
                //todo
            }
        });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM