Context Menu?

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
User avatar
JocPihl
Posts: 4
Joined: Wed Jan 25, 2017 8:35 pm
Contact:

Context Menu?

Post by JocPihl » Wed Mar 29, 2017 11:05 am

Hello!

In my application I would need a context menu in DocuVieware. Best solution would be a configurable one in DocuVieware! :-) But that's a request for future releases I think.

There are a bunch of jquery/javascript context menu implementations out there. As an example I choose this one: https://swisnl.github.io/jQuery-context ... input.html It has all the features I need in my application...

Now to the problem. This is the first part of the function to initiate the context menu.

Code: Select all

 $(function () {
        $.contextMenu({
            selector: '#viewerContainerDocuVieware1',
            trigger: 'right',
            callback: function (key, options) {
                var m = "clicked: " + key;
                window.console && console.log(m) || alert(m);
            }
I can attach the code to the "viewerContainerDocuVieware1" div but for some reason it only triggers on left clicks (trigger: 'left'), not right clicks (trigger. 'right'). I can not use it on left clicks, it overrides standard DocuVieware functions, like select an annotation. Something, when I load DocuVieware component, seems to be messing with my context menu script if I use trigger: 'right'. Any idea how I can make it work? Or do you have a suggestion of a context menu I can use that does the same thing as my example above?
Regards
Jocke Pihlström
Alcom System AB

Cedric
Posts: 259
Joined: Sun Sep 02, 2012 7:30 pm

Re: Context Menu?

Post by Cedric » Tue Apr 04, 2017 12:42 pm

Events are taken care of in the DocuVieware control and the right-click event in particular triggers a context menu of our own that is shown when you select text and want to copy it to the clipboard. This is the only right-click context menu we allow by design.

The decision was made not to use context menu for several reasons.

There is nothing wrong with context menu in a standard Windows application but it should be considered as a bad practice in a web application as it breaks the default UX and browser behavior. The user expectation is that right-clicking in a web page will give you the standard web-page menu where you can print, open links in new windows, view source, etc...
The other aspect we had to take into account when we took this decision is that a web application can be accessed from a touchscreen device such as a tablet or a smartphone and because right-click does not exist with touch screen, the features in the menu would be hidden from the user which is bad UX.

While we can't prevent you from using context menu on other elements than DocuVieware and because we thought about this very seriously, I strongly advice to reconsider using context menus in web application.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest