Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

Detect right click ?

Author Message
SimoX



Joined: 18 Sep 2006
Posts: 2

Posted: Fri Nov 30, 2007 - 5:17 pm    Post subject: Detect right click ? Reply with quote

Hi,
I'm looking for a tip to detect the right click or ctrlKey with javascript or cocoa on widget (used for a custom contextual menu).

I've already use those function, but that didn't works : Sad

Code:
if(event.ctrlKey){
}

if(event.button == "-2"){
}



Any help will be greatly appreciated.
_________________
Save more than 30% on your next Mac or iPod with Refurb Store widget.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
Greenie



Joined: 08 Jun 2005
Posts: 81

Posted: Sun Dec 02, 2007 - 7:53 pm    Post subject: Reply with quote

I might be wrong here, but I think keys like ctrl or command are only registered (via javascript) when typed together with another key that returns a visible character. In other words: I think you only receive something like ctrl+a but not ctrl alone.

But: It should be possible to use an onclick-event and then (in the event-handler) to test if the ctrl-key was clicked while the mousebutton was pressed. The only problem (at least I think so) is that this is probably not registered as a click on the right button of a two-button mouse, so the user probably has to use ctrl in conjunction with any mousebutton to get this context-menu you plan to implement.

Hope that helps.
View user's profile Send private message Send e-mail AIM Address ICQ NumberWidgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group