PDA

View Full Version : NSScroller -- drawArrow:highlight:




Masna
Apr 20, 2007, 03:57 PM
Hey everyone.

I'm currently writing a custom NSScroller class (to change its look). But, I'm having trouble drawing the arrows. Basically, when is drawArrow:highlight: called? I assumed it'd be called whenever drawKnob was called (or at least in init and whenever it's clicked), but apparently not.

Thanks in advance!



slooksterPSV
Apr 21, 2007, 09:50 PM
Its invoked by other NSScroller methods, I'm not sure what ones, but I'll try to find out which ones.

letof
Jun 7, 2007, 12:30 PM
Basically, when is drawArrow:highlight: called?

from drawRect: BUT DEFAULT IMPLEMENTATION DOES NOT DO THIS ! :mad:

overwrite drawRect: in your subclass.

- (void)drawRect:(NSRect)rect
{
//#warning unexpected method [NSScroller drawKnobSlotInRect:highlight:]
[self drawKnobSlotInRect:[self rectForPart:NSScrollerKnobSlot] highlight:NO] ;
[self drawArrow:NSScrollerIncrementArrow highlight:( [self hitPart] == NSScrollerIncrementLine )] ;
[self drawArrow:NSScrollerDecrementArrow highlight:( [self hitPart] == NSScrollerDecrementLine )] ;
[self drawKnob] ;
}


Note : drawKnobSlotInRect:highlight: does not appear in NSScroller interface too !

Bug or not ? I don't know !

Read you later.