Skip navigation.
 
mlUsing Scrolling in a subclass of NSView
FROM : Jérôme Paschoud
DATE : Thu Jan 03 18:06:47 2002

Hi everyone,
I'm newbie to cocoa programming, and I try to generate a user interface for
a simple 2D grapher and in this soft I need to scroll my view. In fact I
have a subclass of NSView in wich i'm drawing my function (i.e y=x^2) and I
want to be able to click on one point of my NSView and get the new view
centered where i clicked. In order to get that I override the methode
mouseDown.
Here's the 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];
}

That is working: I explain no error during compilation, no error when
running but nothing happened when I click. And the only thing i'm sure is
that i'm going into thi method because when I set a breakpoint to see if
there's a NSPoint loc create, I'm able to see it and the coordinates i get
seems to be ok.

Thanks to anyone who can help me.

Regards Jerome

--
Mac like the best, die like the rest.
Paschoud Jirtme
Student
Email:
Private-><email_removed>
Profesional-> jerome.<email_removed>
Phone: 022-774-27-31
Handy: 078-625-27-31


Related mailsAuthorDate
mlUsing Scrolling in a subclass of NSView Jérôme Paschoud Jan 3, 18:06
mlRe: Using Scrolling in a subclass of NSView Stefan Jung Jan 4, 14:06