Skip navigation.
 
mlRe: custom NSRulerView
FROM : Koen van der Drift
DATE : Thu Jan 30 19:04:49 2003

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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlcustom NSRulerView Koen van der Drift Jan 30, 16:36
mlRe: custom NSRulerView Marco Binder Jan 30, 17:43
mlRe: custom NSRulerView Koen van der Drift Jan 30, 19:04
mlRe: custom NSRulerView Koen van der Drift Jan 30, 19:33
mlRe: custom NSRulerView and other related issues Michael Latta Apr 6, 23:18
mlRe: custom NSRulerView and other related issues Koen van der Drift Apr 7, 15:46