Re: Handling right click only
Re: Handling right click only
- Subject: Re: Handling right click only
- From: Alexander Griekspoor <email@hidden>
- Date: Tue, 14 Dec 2004 09:47:21 +0100
Thanks Severin, but this is not exactly what I need, the question is,
can an event fired to [self nextResponder] end up eventually at a
different application? What I want is all events to be redirected as if
my window wasn't there, except for right mouse clicks:
The situations is as follows (as seen from the side):
**** **** **** finder icons
----------------- my semi transparent CD window
++++++++++ finder desktop
The moment I disable the clickthrough of my window it will start
catching all mouse events away from the finder, even though its desktop
icons are projected above my window....
Alex
Op 14-dec-04 om 9:01 heeft Severin Kurpiers het volgende geschreven:
Hi Alexander,
here is an idea to start with. Create a menu in your nib file and set
the outlet "menu" of your view to the new created menu. Connect menu
items with appropriate actions. Then overwrite the NSView method
menuForEvent: in your NSView subclass to something like this:
- (NSMenu *)menuForEvent:(NSEvent *)event
{
if([event type] == NSRightMouseDown || ([event type] ==
NSLeftMouseDown && ([event modifierFlags] & NSControlKeyMask)))
{
// do whatever you want to do here
}
return [[self nextResponder] menuForEvent:event];
// or, alternatively, maybe it will better suit your needs:
//return nil;
}
Note: This will handle a right mouse click and a left mouse click
while the control key is pressed, which would be probably the expected
behavior in your case.
Hope this helps.
Bye,
Severin Kurpiers
Verek Ltd.
On 14. Dez 2004, Alexander Griekspoor wrote:
Hi all,
Some of you might have seen our funny little app called Disctop which
projects your CD on your desktop. I want to add a few features
including a contextual menu. Now Disctop's main window is set to
ignore
any mouse clicks right now and hovers between the desktop background
and the icons of the finder. What I would like to achieve is that
Disctop ONLY accepts the right mouse clicks and presents the
contextual
menu in that case, while ALL other events should be forwarded to any
responder which comes next, including those in applications with
windows below ours (read: the finder). Thus, I want to catch the right
clicks but have the left clicks and drags be normally handled by the
finder such that I can still move the desktop icons around.
Any clues?
Many thanks in advance!!
Cheers,
Alex
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden