Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Menu click handler and sample code best practice question

    Hi Isomorphic,

    I want to implement a right-click menu for ListGrid using addRowContextClickHandler + HStack with Menu + SomeClickHandler for the menu.

    I saw that there is MenuItemClickEvent which sounds like it is the correct event to add a handler for at the menu.
    There is also ItemClickEvent, which is also in the same package but does not sound that perfectly right.
    The Javadocs don't help here which to use and this sample uses the latter one.

    Could you explain what to use and what the difference between those two is?
    I'm using current 5.1p.

    Thank you & Best regards
    Blama


    #2
    Why are you looking only at the event classes? Look on Menu and MenuItem at the APIs that allow you to register for each type of event, and usage is explained.

    Comment


      #3
      Hi Isomorphic,

      I did look there before. Now the confusion is solved. I was surprised to see MenuItem has addClickHandler(ClickHandler handler) and not something called addMenuItemClickHandler.
      Looking deeper, this ClickHandler (from com.smartgwt.client.widgets.menu.events) has the onClick(MenuItemClickEvent event) I was looking for.

      But the naming is inconsistent IMHO. If you search the all-classes doc for "ClickHandler", you'll see that all other ClickHandlers with a specific purpose have a prefix, only this one does not.

      Best regards
      Blama

      Comment

      Working...
      X