Announcement

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

    Mouse Middle Button Event

    Hi everyone,

    Is it possible to create a Mouse Middle Button Event?

    I'm trying to implement a close tab when the user press the mouse middle button.

    Thanks,
    António Santos

    #2
    I'm also looking for events to catch the middle mouse click. I've seen one for the Wheel, but that's for wheel scroll events, not clicks.

    Are there no such event handlers available?


    * For the same reason too: when a user hovers over a tab title (without the tab needing to be selected), clicking middle mouse can close the tab (with some business check first).

    Comment


      #3
      We've added a new API EventHandler.middleMouseDown() to 4.1 and up to allow detection of the middle mouse, when it exists on the device.

      Obviously, since not all input devices support a middle click function, this should be for power user shortcuts only.

      Comment


        #4
        Thanks!

        Got it working by implementing
        Code:
        com.smartgwt.client.widgets.tab.events.TabDeselectedEvent ::
        if (EventHandler.middleButtonDown()) {
          ... check some rules to determine if tabCanBeClosed...
          if (tabCanBeClosed) {
            event.cancel();
            removeTab(TabDeselectedEvent.getNewTab())
          }
        }
        since the middle mouse click will throw a TabSelectedEvent if the TabDeselectedEvent is not cancelled first, and you might not want to select the tab first if you want to close a tab with middle mouse click.


        Works great!

        Comment

        Working...
        X