• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Cutsom NSRulerView : strange problems with drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cutsom NSRulerView : strange problems with drawing


  • Subject: Cutsom NSRulerView : strange problems with drawing
  • From: Eric MORAND <email@hidden>
  • Date: Tue, 22 May 2007 09:51:04 +0200

Hi list,

I'm trying to subclass NSRulerView to display custom informations, and am facing a strange problem when I subclass the draw... methods.

Here is my implementation of draw... methods :

- (void)drawBackgroundInRect:(NSRect)rect
{
NSLog (@"drawBackgroundInRect");

NSRect backgroundRect = NSZeroRect;
NSRect bottomBorderRect = NSZeroRect;

NSDivideRect([self bounds], &bottomBorderRect, &backgroundRect, 1.0, NSMaxYEdge);

// Fond

[[NSColor colorWithDeviceRed:194.0/255.0 green:194.0/255.0 blue: 194.0/255.0 alpha:1.0] set];

[NSBezierPath fillRect:backgroundRect];

// Bordure inferieure

[[NSColor colorWithDeviceRed:119.0/255.0 green:119.0/255.0 blue: 119.0/255.0 alpha:1.0] set];

[NSBezierPath fillRect:bottomBorderRect];
}



- (void)drawHashMarksAndLabelsInRect:(NSRect)rect
{
NSLog (@"drawHashMarksAndLabelsInRect");

// Test : only display a mark at bounds origin, just to see what happens

NSBezierPath * aPath = [NSBezierPath bezierPathWithRect:NSMakeRect (NSMinX([self bounds]), 0.0, 1.0, 10.0)];

[[NSColor colorWithDeviceRed:119.0/255.0 green:119.0/255.0 blue: 119.0/255.0 alpha:1.0] set];

[aPath fill];
}


Every time I scroll the associated scroll view, the drawBackgroundInRect method is called, correctly filling the background, and then the drawHashMarksAndLabelsInRect method is called.

The problem is that the hash mark supposed to draw at bounds origin is not drawn when I scroll to the right...and is drawn multiple times when I scroll to the left ! Even so the entire bounds area has already been filled by drawBackgroundInRect.

Can someone help me on this ?
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Cutsom NSRulerView : strange problems with drawing
      • From: Uli Kusterer <email@hidden>
    • Re: Cutsom NSRulerView : strange problems with drawing
      • From: Eric MORAND <email@hidden>
  • Prev by Date: Re: -mouseMoved: not being called
  • Next by Date: Re: Cutsom NSRulerView : strange problems with drawing
  • Previous by thread: POSIX error: Broken pipe
  • Next by thread: Re: Cutsom NSRulerView : strange problems with drawing
  • Index(es):
    • Date
    • Thread