NSScroller -- drawArrow:highlight:

Discussion in 'Mac Programming' started by Masna, Apr 20, 2007.

  1. Masna macrumors newbie

    Joined:
    Apr 20, 2007
    #1
    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!
     
  2. slooksterPSV macrumors 68040

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #2
    Its invoked by other NSScroller methods, I'm not sure what ones, but I'll try to find out which ones.
     
  3. letof macrumors newbie

    Joined:
    Jun 7, 2007
    #3
    drawArrow:highlight: from drawRect:

    Basically, when is drawArrow:highlight: called?

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

    overwrite drawRect: in your subclass.

    Code:
    - (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.
     

Share This Page