Re: custom NSRulerView and other related issues
Re: custom NSRulerView and other related issues
- Subject: Re: custom NSRulerView and other related issues
- From: Michael Latta <email@hidden>
- Date: Sun, 6 Apr 2003 14:18:25 -0700
I too am working on a custom ruler view. There is a method
"requiredThickness" that is queried by the scroll view. The size will
be set correctly ONCE, and again queried and set each time the
NSScrollView is resized using the resize box.
My rulers can grow programmatically (on a drop actually) and I have
been trying to get the scroll view to lay out the components on
command. There is even a method documented to do this "tile" that does
get called when it is resized (and is the method that calls
requiredThickness). But, I have been unable to get it to resize the
ruler view area unless it is being resized from the resize box.
I have tried calling "tile", and both methods for resizing the view
(resizeSubviewsOldSize, resizeWithOldSuperviewSize:), all to no avail.
Michael Latta
On Thursday, January 30, 2003, at 10:04 AM, Koen van der Drift wrote:
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.
_______________________________________________
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.