Edit AllPages

I am working on implementing a vertical CustomNSScroller for my app. So far I have the following code:

// Draws the knob

// Draw the scroll bar arrows

// Draws the knob background

Only two problems are holding this back from having perfect functionality:

  1. When my window is not key, and the “inactive” version of the scroll bar is drawn, the whole scroll bar is not updated and only certain sections (around the arrows and knob) are updated to look “inactive”. Maybe I am approaching this wrong but I can’t figure it out for the life of me.

  2. NSScrollerIncrementArrow gets the “highlight” flag perfectly and draws the “clicked” version of the arrow every time when it should. However, NSScrollerDecrementArrow never gets the highlight flagged called at all even though I use the exact same code for both. Any ideas?

Thanks for any help!

The flag variable of drawArrow:highlightPart: is -1 when nothing should be highlighted, 0 when the decrement button should be highlighted and 1 when the increment button should be highlighted. The only problem I have, is that the arrow variable doesn’t pass the correct arrow (it’s almost always NSScrollerIncrementArrow) to highlight. This is my solution (The only way I could make it work. If anybody has a better solution, please post it!).

Looks like it actually is drawing the decrementArrowHighlighted image, it’s just that it immediately draws the decrementArrow right after it. Not sure why, but I’ll post again if I can figure it out.

In the past I’ve made drawArrow: and drawArrow empty methods and instead done all of the drawing in drawRect: . I then used the NSScroller hitPart method to determine which piece to highlight – RbrtPntn