Re: Standard "combo" button class?
Re: Standard "combo" button class?
- Subject: Re: Standard "combo" button class?
- From: Andreas Mayer <email@hidden>
- Date: Mon, 19 Mar 2007 22:52:09 +0100
Am 19.03.2007 um 22:21 Uhr schrieb Nicholas Meyer:
I'm curious, is there a standard class for the type of button which
sends an action when clicked OR opens a menu when the mouse button
is pressed and held for a short time (i.e. the Build button in XCode)?
I don't think there is.
If not, would subclassing NSButton to set an NSTimer on mouseDown:
that shows the menu and short-circuits the button's tracking loop
be the best way to handle it? Or is there a way to subclass
NSPopUpButton that would be easier?
I guess something like that is possible.
But the "right" way is probably to replace the cell's mouse handling
code. Have a look at my AMRollOverButton class. It has the ability to
display a pop up menu:
http://www.harmless.de/cocoa-code.php#rollover
Just ignore all the drawing stuff; the interesting part is
AMRollOverButtonCell's -trackMouse:inRect:ofView:untilMouseUp: method.
Andreas
_______________________________________________
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