Skip navigation.
 
mlRe: background of NSButton and NSPopUpButton
FROM : Don Willems
DATE : Thu Nov 25 22:11:33 2004

> That is quickly done, just make the NSRect in which the cell is drawn
> smaller:


How easy can it be ;-)

>> The biggest problem now is highlighting, if I click a button, the
>> button background becomes white, not aqua blue.

>
> Okay, I am not sure how to go about this. You could subclass
> NSButtonCell and play around with the -highlight:withFrame:inView:
> method.


My first thought was overriding - (NSColor
*)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView to change the color of the highlight to a blue
semi-transparent highlight.

> But I think it will not be very trivial to implement the typical aqua
> semi-transparent blue glow. Maybe you can work with exchanging the
> background image by a highlighted one?


That (although less generic) might be the best (most beautiful) idea.

I've been playing around some with subclassing NSButtonCell, but I just
can't get it to work. None of the methods in my subclass gets called. I
tried to set the Cell class with +setCellClass in NSControl, I've
overridden +cellClass, also in NSControl to return my subclass. But
nothing seems to have any effect.
The only thing that had some effect was using setCell, but that
resulted in ugly windows like buttons without an image.
How do you change the cell of a button?

Thanks for your help,

Don

Related mailsAuthorDate
mlbackground of NSButton and NSPopUpButton Don Willems Nov 25, 11:20
mlRe: background of NSButton and NSPopUpButton Michael Becker Nov 25, 12:00
mlRe: background of NSButton and NSPopUpButton Don Willems Nov 25, 13:32
mlRe: background of NSButton and NSPopUpButton Michael Becker Nov 25, 15:25
mlRe: background of NSButton and NSPopUpButton Don Willems Nov 25, 22:11
mlRe: background of NSButton and NSPopUpButton Ryan Stevens Nov 25, 23:47
mlRe: background of NSButton and NSPopUpButton Don Willems Nov 26, 09:15
mlRe: background of NSButton and NSPopUpButton Don Willems Nov 26, 09:22