Re: Highlighting NSImageCells in an NSMatrix
Re: Highlighting NSImageCells in an NSMatrix
- Subject: Re: Highlighting NSImageCells in an NSMatrix
- From: Daryn <email@hidden>
- Date: Sat, 31 Jan 2004 01:47:56 -0600
Here's the method you need to implement:
- (void)setHighlighted:(BOOL)flag
Sets whether the receiver has a highlighted appearance, depending on
the Boolean value flag. By default, it does nothing. NSButtonCell
overrides this method to draw the button with the appearance specified
byNSCellLightsByBackground, NSCellLightsByContents, or
NSCellLightsByGray.
In the implementation, use NSSetFocusRingStyle and NSFillRect to draw
the ring. Or perhaps use the control view's
setKeyboardFocusRingNeedsDisplayInRect:.
Hope this helps.
On Jan 30, 2004, at 7:22 AM, Michael Becker wrote:
>
> So I got my NSMatrix with NSImageCells. I can select my cells, but
>
> they don't get highlighted when I do. After changing the
>
> prototype-cell to an NSTextFieldCell, they get highlighted nicely. I
>
> tried [ matrix setDrawsCellBackground:NO], didn't work. Then I
>
> subclassed NSImageCell to override the drawWithFrame:inRect:inView:
>
> method so it would directly call drawInteriorWithFrame, didn't work
>
> either. I even made drawWithFrame: draw nothing at all to the screen.
>
>
>
> I assume that, when trying to highlight a cell, NSMatrix sends the
>
> appropriate message to the appropriate cell. So I guess that I have
>
> to do something with the cell's highlighting methods... but I thought
>
> highlighting an NSImageCell was kind of a common thing and not
>
> something that you're supposed to code yourself.
>
>
>
> Am I just missing out on something very simple, or do I really have
>
> to subclass NSImageCell and provide my own highlighting-code?
>
>
>
>
I have the feeling that there really is no "simple" way to do that. So
>
if anybody knows how to achieve this, I'd be happy to know :)
>
>
Thanks,
>
Michael
>
_______________________________________________
>
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.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.