Re: NSSlider responding to superview's drawRect

2008-06-10 Thread Graham Cox
I don't think it's worth attempting. I *think* that gradients are cached in some way so trying to recalculate the gradient to span the update rect correctly is: a) going to need a fair bit of work to calculate and b) not allow caching to work efficiently. In any case, pixels that are clippe

Re: NSSlider responding to superview's drawRect

2008-06-10 Thread Michael Watson
This is normally what I have to do as well, but is there a more optimized way to achieve the goal of drawing only the rect that needs redrawing? -- m-s On 10 Jun, 2008, at 12:05, Ken Ferry wrote: You're probably filling your gradient into the rect passed in drawRect. That rectangle jus

Re: NSSlider responding to superview's drawRect

2008-06-10 Thread Jonathan Dann
On 10 Jun 2008, at 17:05, Ken Ferry wrote: You're probably filling your gradient into the rect passed in drawRect. That rectangle just represents the dirty part of your view. If you had a solid color to draw, you could just fill the rect, but with a gradient you will get your gradient, t

Re: NSSlider responding to superview's drawRect

2008-06-10 Thread Ken Ferry
You're probably filling your gradient into the rect passed in drawRect. That rectangle just represents the dirty part of your view. If you had a solid color to draw, you could just fill the rect, but with a gradient you will get your gradient, top to bottom, within this possibly small rect

Re: NSSlider responding to superview's drawRect

2008-06-10 Thread Andy Lee
Check the code that draws the 1-pixel line. It should be calculating coordinates of the line based on the view's bounds rectangle, not the rectangle that is passed to drawRect:. --Andy On Jun 10, 2008, at 11:51 AM, Jonathan Dann wrote: Hi All, This is something that I haven't seen before

NSSlider responding to superview's drawRect

2008-06-10 Thread Jonathan Dann
Hi All, This is something that I haven't seen before. I have a custom view that inherits from NSView directly and just draws a gradient background. In IB I've placed an NSSlider on the view which works fine. The problem comes when drawRect in my custom view is invoked, I draw the gradient