GWT TextBox KeyPressHandler问题

发布于 2024-12-05 07:01:21 字数 1102 浏览 0 评论 0原文

我正在使用带有 uibinder 的 gwt 2.3。 在此我使用了一个文本框,我想在其中添加按键处理程序。 下面是我的代码。对于 ui.xml

<g:HTMLPanel>
    <g:AbsolutePanel ui:field="absolutePanel">
        <g:HorizontalPanel>
            <g:TextBox ui:field="searchTB" ></g:TextBox>

        </g:HorizontalPanel>

    </g:AbsolutePanel>
</g:HTMLPanel>

对于 .java

@UiField 文本框搜索TB;

@Inject
public LibraryFormView(final Binder binder) {
    widget = binder.createAndBindUi(this);


    searchTB.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            // TODO Auto-generated method stub

        }
    });
}

运行应用程序时&加载此页面时出现如下错误。

[DEBUG] [v4workflow] - Rebinding com.nextenders.client.view.workflow.LibraryFormView.Binder
[DEBUG] [v4workflow] - Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator
    [ERROR] [v4workflow] - Method 'onKeyPress' must have a single event parameter defined.

我不明白我错在哪里。 请帮助我。提前致谢。

I am using gwt 2.3 with uibinder.
In this I used a text box, On which I want to add keypress haldler.
Here below is my code. for ui.xml

<g:HTMLPanel>
    <g:AbsolutePanel ui:field="absolutePanel">
        <g:HorizontalPanel>
            <g:TextBox ui:field="searchTB" ></g:TextBox>

        </g:HorizontalPanel>

    </g:AbsolutePanel>
</g:HTMLPanel>

for .java

@UiField
TextBox searchTB;

@Inject
public LibraryFormView(final Binder binder) {
    widget = binder.createAndBindUi(this);


    searchTB.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            // TODO Auto-generated method stub

        }
    });
}

while running application & loading this page it is giving error like below.

[DEBUG] [v4workflow] - Rebinding com.nextenders.client.view.workflow.LibraryFormView.Binder
[DEBUG] [v4workflow] - Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator
    [ERROR] [v4workflow] - Method 'onKeyPress' must have a single event parameter defined.

I am not getting at what place I am wrong.
Please help me out.Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

行雁书 2024-12-12 07:01:21

似乎您在 LibraryFormView 中有一个名为 onKeyPress 的方法,该方法错误地用 @UiHandler 进行了注释。

请参阅 http://www.google.com/codesearch#search&q=%22must+have+a+single+event+parameter+define%22+package:http://google-web-toolkit %5C.googlecode%5C.com(它在 getUiHandlers 上循环)

It seems like you have a method named onKeyPress in LibraryFormView that is erroneously annotated with @UiHandler.

See http://www.google.com/codesearch#search&q=%22must+have+a+single+event+parameter+defined%22+package:http://google-web-toolkit%5C.googlecode%5C.com (it's in a loop over getUiHandlers)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文