advertisement

Article:
  Building a Scratch Pad with Cocoa
Subject:   How to use scrolling in a NSView Subclass
Date:   2001-12-31 07:07:13
From:   zeus
I try to make a very simple sofware, and in that sofware I need to scroll the view. Here is my code:


-(void)mouseDown:(NSEvent *) theEvent{
NSPoint loc = [theEvent locationInWindow];
loc.x -= [self frame].origin.x;
loc.y -= [self frame].origin.y;
[self scrollPoint:loc];
[self setNeedsDisplay:YES];
}

I'm using a methode scrollPoint:aPoint from the NSView Class but i can't hardly get a scroll. I'm sure that i'm going into this method because when I ran my soft in debugger mode I get the right coordinates of the point "loc".


Does anyone have an idea ?