FROM : Peter Ammon
DATE : Tue Jan 15 20:30:49 2008
On Jan 15, 2008, at 9:45 AM, Mitchell Hashimoto wrote:
> Hello,
>
> I'm trying to get the XCode style contextual menu to popup when a
> button is clicked on my toolbar (such as the "Build" button if you
> hold it), but I can't figure out exactly how to do this!
>
> Should I be subclassing NSPopupButton? NSButtonCell? Is there an
> easier way for me to do this?
Hi Mitchell,
I'd say the easiest way to do this is with a single segment,
momentary style NSSegmentedControl. You can assign both a menu and
an action to the control to get this behavior. Because segmented
controls always draw their bezels, you should override drawRect: if
you want it to look like Xcode's buttons.
I hope that helps,
-Peter
DATE : Tue Jan 15 20:30:49 2008
On Jan 15, 2008, at 9:45 AM, Mitchell Hashimoto wrote:
> Hello,
>
> I'm trying to get the XCode style contextual menu to popup when a
> button is clicked on my toolbar (such as the "Build" button if you
> hold it), but I can't figure out exactly how to do this!
>
> Should I be subclassing NSPopupButton? NSButtonCell? Is there an
> easier way for me to do this?
Hi Mitchell,
I'd say the easiest way to do this is with a single segment,
momentary style NSSegmentedControl. You can assign both a menu and
an action to the control to get this behavior. Because segmented
controls always draw their bezels, you should override drawRect: if
you want it to look like Xcode's buttons.
I hope that helps,
-Peter
| Related mails | Author | Date |
|---|---|---|
| Mitchell Hashimoto | Jan 15, 18:45 | |
| Peter Ammon | Jan 15, 20:30 | |
| Mitchell Hashimoto | Jan 15, 21:18 | |
| PGM | Jan 15, 22:29 |






Cocoa mail archive

