• 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: Menu-less popup buttons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Menu-less popup buttons


  • Subject: Re: Menu-less popup buttons
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Thu, 20 May 2004 16:16:49 -0700

Hello...

I think it is the item displayed in the NSPopUpButton in it's un-"popped" state that Gwynne is trying to avoid showing, not the menu associated with it.

Have you tried using the NSButtonCell instance method setUsesItemFromMenu:to FALSE/NO? This should (untested, based on the docs) prevent the selected/first item from being drawn if that is what is overlapping the arrow.

In terms of accomplishing #3, you could just override the NSCell drawing methods if you wanted to subclass NSPopUpButtonCell to give it the appearance you want, without changing the rest of the functionality.

In addition to the public drawing methods inherited from NSCell, NSPopUpButtonCell also implements the following related drawing methods:

( from using class-dump on AppKit, all of the normal caveats about using private/unsupported API apply)

- (void)_drawThemePopUpBorderWithFrame:(NSRect)fp8 inView: (NSView *)fp24 bordered:(BOOL)fp28 style:(int)fp32;
- (void)_drawStandardPopUpBorderWithFrame:(NSRect)fp8 inView:(NSView *)fp24;
- (void)drawBorderAndBackgroundWithFrame:(NSRect)fp8 inView: (NSView *)fp24;

Hope that helps,

Louis


Perhaps you should take a few steps back and very generally describe what you are trying to do...

From what you have described, I would discourage doing what you want to do. The reason is that a pop-down arrow in OS X universally means that a menu will be presented when the arrow is clicked. Any aberration from this principle will likely confuse the user.

Perhaps you simply want a disclosure triangle?

-- Daniel Currie


On 2004 May 20, at 10:55, Gwynne wrote:

In Carbon, one can create a popup button without the selected item visible by creating the control in IB and shrinking it down to just the width of the disclosure arrow (24 pixels). This does not work with Cocoa's NSPopUpButton; the attempt causes the selected item area to intrude on the disclosure arrow area. My question: Can you either 1) get the Cocoa button to draw the way the Carbon one does, 2) Embed the Carbon version into a Cocoa window (my attempts at this have failed miserably), or 3) Create a control that's just the arrow instead of the entire popup menu?

-- Gwynne, key to the Code that runs us all
Formerly known as Sailor Quasar.
Email: email@hidden
Web: http://musicimage.plasticchicken.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Menu-less popup buttons (From: Gwynne <email@hidden>)
 >Re: Menu-less popup buttons (From: Daniel Todd Currie <email@hidden>)

  • Prev by Date: Re: Does not execute on launch
  • Next by Date: Re: Menu-less popup buttons
  • Previous by thread: Re: Menu-less popup buttons
  • Next by thread: Re: Menu-less popup buttons
  • Index(es):
    • Date
    • Thread