Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Regular Contributor
Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800

Detect Trackpad/Trackball Being Clicked

Hi all. Is there any way to detect trackpad/trackball being clicked by a user? I have tried looking in the API but it only capture Menu and Escape key. 


I have this function that submit claim for approving, when the user clicks on the Approve icon using trackpad/trackball, the user will be redirected to another screen to notifiy the user upon the sucess/failure of the approving process. 


The problem I'm having is that even though the user is in different screen, the html, css and javascript all has been re-written but if the user accidentally clicks on the trackpad/trackball the Approve function will be called again(there is no Approve icon in the new screen).





Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Detect Trackpad/Trackball Being Clicked

Trackpad & trackball click events are translated into DOM click events.  


So you could capture the event where someone uses the trackpad to click on a page element with ID 'approveIcon' like this:


var icon = document.getElementById("approveIcon");

icon.addEventListener("click", function(e) {
   //do something ...
}, false);


Follow me on Twitter: @n_adam_stanley
Your app doesn't work? Use BlackBerry remote web inspector to find out why.