Announcement

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

    Disable Browser Default Context Menu / Right Click

    Hi All,

    Is there a way in SmartGWT/GWT to disable the default context menu when the user right click on the browser? So if I register a ContextMenu in SmartGWT, that ContextMenu will be shown. But if I do not register any ContextMenu, then right clicking would be "disabled", that is no browser context menu will be shown. Hope can get an advice on this. Thanks.

    #2
    In my case, I have an HTMLPane object (pane) and add a context menu handler as such:

    Code:
    pane.addShowContextMenuHandler(new ShowContextMenuHandler() {
         @Override
          public void onShowContextMenu(ShowContextMenuEvent event) {
               event.cancel();
                 
          }
    });
    However, on OS X at least, Chrome and Firefox both still show the right context menu; it only works on Safari.

    Comment


      #3
      Hi ,

      this.addShowContextMenuHandler(new ShowContextMenuHandler() {
      @Override
      public void onShowContextMenu(ShowContextMenuEvent event) {
      event.cancel();

      }
      });
      and its working fine in all application , but the context menu still appear on disabled imags and didnt appear when the imag is enabled , and on selectitem .

      can any help me with that


      Regards

      Comment


        #4
        Hi ,

        Is this the correct behavior ????

        so when the Imag disabled it will show context menu although it didnt do that when its enabled ??????

        how can i disable the context menu in all situation ????

        Comment


          #5
          Hi,
          i have somewhat same issue.

          Sample Code:
          ----------------------------------------------------------------------------------------------------------------
          final Menu menu = new Menu();
          MenuItem showNotes = new MenuItem("Show Notes");
          menu.addItem(showNotes);
          grid.setShowCellContextMenus(true);
          grid.addCellContextClickHandler(new CellContextClickHandler() {

          @Override
          public void onCellContextClick(CellContextClickEvent event) {
          menu.moveTo(event.getX(), event.getY());
          menu.show();
          }
          });
          ----------------------------------------------------------------------------------------------------------------

          Observation :
          1. Grid-with DataSource works fine.(Context_Menu_without_DataSource.png)
          2. Grid-with Data source show (edit/delete) menus by default (Context_Menu_With_DataSource.png) , And after selection of Edit it show the Form besed on Datasource provided. (Context_Menu_With_DataSource_Form.png)

          Query : How can I suppress the default behaviour & apply with my own menu ?
          Attached Files

          Comment

          Working...
          X