Re: Questions for implementing pop-up contextual menus for Ctrl-Click and Right-Click
Re: Questions for implementing pop-up contextual menus for Ctrl-Click and Right-Click
- Subject: Re: Questions for implementing pop-up contextual menus for Ctrl-Click and Right-Click
- From: "E. Wing" <email@hidden>
- Date: Tue, 21 Nov 2006 19:58:42 -0800
Thank you for the reply. I will stick with mouseDown: then.
But for the second question, I don't think I can reliably track this
information myself. The problem is that if the user clicks outside my
view to cancel a menu, my view won't receive the event, and I won't be
able to change the isMenuVisible flag. Is there a Cocoa API that can
tell me if this menu is open?
Thanks,
Eric
On 11/21/06, Alan Smith <email@hidden> wrote:
To answer your first question:
I would go with mouseDown: because you've already implemented it and
it gives you more functionality.
Second question:
I would set a BOOL so you know the menu is open. For example:
- (void)mouseDown:(NSEvent*)theEvent
{
if (isMenuVisible)
{
// It's open, also set isMenuVisible to NO if you close it.
}
// Your code.
if (Ctrl-Click || Right-Click)
{
isMenuVisible = YES;
[NSMenu popUpContextMenu: menu withEvent: theEvent forView: self];
}
}
Good luck, Alan
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unnecessary, then it
shall evolve."
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins (at) lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden