Web-Client running on iPad and rightclick

Forum to discuss the Web client version of Servoy.

Web-Client running on iPad and rightclick

Postby Harro-DUS » Tue Jan 03, 2012 5:29 pm

I'm developing an Solution.
In that solution the user can call a function onRightClick-Event of specific fields.

RightClick is - as far as I know - not available on an iPad.

Is there an alternative to call a function on an iPad for a field?

One option could be to call that function onAction on the assosiated Label.
But on one Form I have a matrix of 6 x 4 fields. And here I have no labels for those fields but I need to call that Function.

Hope somebody has an idea / solution.

Harro
Harro-DUS
 
Posts: 16
Joined: Wed Dec 07, 2011 5:49 pm

Re: Web-Client running on iPad and rightclick

Postby robwormald » Sat Feb 09, 2013 1:15 am

I experimented with this a while back:

Have a look at https://github.com/eightmedia/hammer.js

You'd need that and the webclient utils plugin... you'd have to register the listeners at runtime, and then register a callback to listen for that event.

the "Hold" event works sort of like a right click, press and hold for x seconds and then it will fire an event with the x y coordinates of the event

etc.

Perhaps as Servoy 7 is mobile focused we could file a feature request to have a long press on a touch device interpreted as a servoy right click?
robwormald
 
Posts: 20
Joined: Sun Feb 13, 2011 7:55 am

Re: Web-Client running on iPad and rightclick

Postby robwormald » Thu Feb 14, 2013 10:15 pm

Update: Here's a code snippet : plop it in an empty text document, and save it somewhere in the application_server/server/webapps/ROOT directory

Code: Select all
var SERVOY_MULTITOUCH = new function(){
   

   this.HammerTime = null;
   
   this.Environment = new function(){
   
//set the root path of where this file lives
      this.basePath = "../innit_app/assets/js/",
      //initialize multitouch
      this.init =  function(){
      //get the hammer.js file
         $.getScript(SERVOY_MULTITOUCH.Environment.basePath + "hammer.js/dist/hammer-latest.js", function(){
//get the hammer.js jquery plugin
            $.getScript(SERVOY_MULTITOUCH.Environment.basePath + "hammer.js/plugins/jquery.hammer.js", function(){
         //log to the client-side console - use chrome web inspector to see this
               console.log('InnitMultitouch Initialized')
         //create a new Hammer for any button elements - you could also use $('body'), etc.
               this.HammerTime = $(':button').hammer();
            //bind to the long-press mulitouch event
               this.HammerTime.on('hold',function(event){
               //stop the default event action
                  event.stopPropagation();
               //trigger the context menu (right-click) action on the button element
                  $(event.target).trigger('contextmenu');
                  
                  });
            
            });
               
               return true;
               
            });
         
      }
   }

   
   var INNIT_MT_instance = this;
};


just fire the plugins.WebClientUtils.executeClientSideJS('path/to/the/file.js') somewhere in your solution onopen method
robwormald
 
Posts: 20
Joined: Sun Feb 13, 2011 7:55 am


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 2 guests