more NSBrowser problems (on Leopard, building with Xcode 2.5 for Tiger+).

My NSBrowser is set to allow multiple and branch selection. In my
custom NSBrowserCell subclass, I over-ride -[NSBrowserCell
drawInteriorWithFrame:inView:] to do some custom drawing when the cell
is selected (I need to draw a bit of extra background, and also to
make the font white).

My over-ridden method looks more or less like this.

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
    BOOL isSelected = [[(NSMatrix *)controlView selectedCells]
containsObject:self];

//    if([self isHighlighted])
    if(isSelected)
    {
        // Do some custom stuff
    }

    [super drawInteriorWithFrame:myFrame inView:controlView];
}

What I'm finding is that if I select one NSBrowser cell, and then
click on another cell to select it instead (*not* as well as), when
drawInteriorWithFrame:inView is hit, both cells show up both in
selectedCells, and isHighlighted, breaking my custom drawing.

However, in this case, surely only one cell should be selected?

Although my custom drawing is broken, the cells do highlight
appropriately, so somewhere the "real" selection state is known.

Where/how can I intercept the "real" selection state and do my drawing
correctly?

-- 
http://www.mildmanneredindustries.com/
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to