Results 1 to 2 of 2

Thread: Ui handling TextButtons addClickHandlers

  1. #1
    Sencha User
    Join Date
    Sep 2007
    Posts
    59
    Vote Rating
    0
      0  

    Default Unanswered: Ui handling TextButtons addClickHandlers

    Can someone explain how to handle buttons in forms that are created through UiBinding?

    For example, I have created the UIBinding Form demo, but the buttons do nothing, so from that perspective the demo is useless.

    In other examples, I see the TextButton being handled by:
    @UiHandler("buttonName")
    void onClick(ClickEvent e) {
    Window.alert("Hi");
    }

    But when I try to use the above as a guide to make a button do something really useful I keep getting this error:
    Field 'buttonName' does not have an 'addClickHandler' method associated.

    Try as I might I am unable to create an addClickHandler that the TextButton will recognize, so can someone please explain how to do this?

    Thanks in Advance.

    Cheers.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109
    Vote Rating
    93
      1  

    Default

    Try this instead:

    Code:
    @UiHandler("buttonName")
    void onClick(SelectEvent e) {
      Window.alert("Hi");
    }
    GXT uses the SelectEvent instead of a ClickEvent to make sure that all possible ways the user might activate the button will work correctly, including tabbing into the button and using the space or enter key. A ClickEvent wouldn't be appropriate there, as there would be no way to report a X,Y position for the click, so instead we abstract out possible selection behavior into the SelectEvent.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •