Hi,

I have a custom view that draws half a frame and a gradient:

- (void)drawRect:(NSRect)rect {

        // This results in darker separator line at left side.
        [[NSColor colorWithCalibratedWhite:0.18 alpha:1.0] set];
        NSRectFill(NSMakeRect(NSMinX(rect), NSMinY(rect), 1, NSHeight(rect)));

        // This results in lighter separator line along bottom.
        [[NSColor colorWithCalibratedWhite:0.41 alpha:1.0] set];
NSRectFill(NSMakeRect(NSMinX(rect) + 1, NSMinY(rect), NSWidth(rect) - 1, NSHeight(rect)));

        // Draw background
NSGradient *gradient = [[NSGradient alloc] initWithStartingColor: [NSColor colorWithCalibratedWhite:0.63 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:1.0 alpha:1.0]]; [gradient drawInRect:NSMakeRect(NSMinX(rect) + 1, NSMinY(rect) + 1, NSWidth(rect), NSHeight(rect) - 1) angle:90.0];

}

In Interface Builder I set an Async progress indicator and a text field as subviews of the custom view. When I turn off the progress indicator however, or when I update the string value of the text field, the drawing from the drawRect method above is drawn offset from its origin, instead drawing at the origin of either of the subviews, resulting in spurious lines being drawn where there should only be background (the gradient). (You can see a screenshot of the effect here: http://sintraworks.com/private/RenderingMess.png)

As you can see from the image it looks like the view first draws itself correctly, then gets drawn for each of the other subviews, with its origin offset to match the origin of the subview in question. I don't understand why this happens.

I have tried several workarounds in IB, among others by promoting the async arrows and text field to not be subviews of the custom view, but simply sit on top of it, but none of the solutions seems to make any difference. Any pointers as to what the issue may be and how I can solve it?

Kind Regards,
António Nunes
SintraWorks

-----------------------------------------
Forgiveness is not an occasional act;
it is a permanent attitude.

--Martin Luther King, Jr
-----------------------------------------




_______________________________________________

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