Has anyone used NSRulerView with graphic or other non-text views?

Nothing extensive - I've done some tests to learn NSRulerView and it seems to work fine with my custom NSViews. My client view is loaded from a nib per document. After nib is loaded, the ruler is set in MyDoument (below), which owns the containing scroll view. I then add various subviews to the client view and adjust the labels when needed (such as at zooming).

- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
        // ...          
        NSArray * stepUp, * stepDown;
        NSNumber * upNumber = [ NSNumber numberWithFloat:2.0 ];
        NSNumber * downNumber = [ NSNumber numberWithFloat:0.5 ];
        stepUp  = [ NSArray arrayWithObject:upNumber ];
        stepDown = [ NSArray arrayWithObject:downNumber ];
[ NSRulerView registerUnitWithName:@"Seconds" abbreviation:@"s" unitToPointsConversionFactor:50 stepUpCycle:stepUp stepDownCycle:stepDown ];
        [ [ self scrollView ] setHasHorizontalRuler:YES ];
        ruler = [ [ self scrollView ] horizontalRulerView ];
        [ ruler setMeasurementUnits:@"Seconds"];
        [ [ self scrollView ]  setRulersVisible:YES ];
        // ...
}

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to