• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Questions for implementing pop-up contextual menus for Ctrl-Click and Right-Click
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Questions for implementing pop-up contextual menus for Ctrl-Click and Right-Click
      • From: PGM <email@hidden>
References: 
 >Questions for implementing pop-up contextual menus for Ctrl-Click and Right-Click (From: "E. Wing" <email@hidden>)
 >Re: Questions for implementing pop-up contextual menus for Ctrl-Click and Right-Click (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: External kill of an NSThread?
  • Next by Date: Re: External kill of an NSThread?
  • Previous by thread: Re: Questions for implementing pop-up contextual menus for Ctrl-Click and Right-Click
  • Next by thread: Re: Questions for implementing pop-up contextual menus for Ctrl-Click and Right-Click
  • Index(es):
    • Date
    • Thread