Re: custom NSRulerView
Re: custom NSRulerView
- Subject: Re: custom NSRulerView
- From: Koen van der Drift <email@hidden>
- Date: Thu, 30 Jan 2003 13:04:49 -0500
At 5:43 PM +0100 1/30/03, Marco Binder wrote:
1) the method signature is --> + <-- (void) setRulerViewClass:(Class)aClass
the "plus" tells you, that the method is a class method: you can
only call it on classes (here [NSScrollView
setRulerViewClass:yourclass])
2) the argument for the above method is of type (Class), NOT (id)
[which would be an object]. You can not pass your ruler object! You
have to pass [MyRulerView class]
Thanks, Marco.
The reason I am subclassing NSRulerView is I want to modify what is
drawn in it. This I do in drawRect, and it works fine - this also
confirms that the custom ruler is created. Also, I want it to be
wider than the standard size. So what I first tried was to override
initWithFrame and use setFrameSize to adjust the width, but that
didn't work. The code was not even executed I noticed when stepping
through the debugger. I then tried setting the frame of myRulerView
after calling setRulerViewClass:
MyRulerView *ruler = [scroller verticalRulerView];
NSRect r = [ruler frame];
r.size.width = 50;
[ruler setFrameSize:r.size];
Again that didn't change the size, although I can see in the debugger
that the framesize has changed. How/where should I call this?
thanks again,
- Koen.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.