• 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: NSMenu on click of a button
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMenu on click of a button


  • Subject: Re: NSMenu on click of a button
  • From: Ryan Britton <email@hidden>
  • Date: Sun, 12 Feb 2006 15:12:24 -0800

You could use a subclass like this:

@implementation MenuButton

- (void)mouseDown:(NSEvent *)theEvent
{
	[self setState:NSOnState];
	[self highlight:YES];

	if ([self menu])
	{
		[NSMenu popUpContextMenu:[self menu] withEvent:theEvent forView:self];
	}

	[self setState:NSOffState];
	[self highlight:NO];
}

@end


On Feb 12, 2006, at 12:39 PM, Alan Smith wrote:

Okay, heres the plan. I want to have a button that when clicked once, pops
up a menu, like the dock does except you don't have to hold the mouse down
to see the menu. I don't want it to be a NSPopupButton, or whatever it's
called, because it would stiil have those little arrows next to it, even
when borderless. If there is a way to get rid of the arrows I would be able
to do this VERY easily.
I messed around with NSViews setMenu but that is only displayed if you right
click. I want it to be left click.


Thanks in advance, Alan
 _______________________________________________
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

_______________________________________________ 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
References: 
 >NSMenu on click of a button (From: Alan Smith <email@hidden>)

  • Prev by Date: Re: Who's launching me?
  • Next by Date: Re: Who's launching me?
  • Previous by thread: Re: NSMenu on click of a button
  • Next by thread: NSUserDefaults for portable applications
  • Index(es):
    • Date
    • Thread