I want my NSTextView to show only 32 characters per line and the 33rd
character should be shown at next line of textview.

My NSTextView will have fixed font.

If your font is truly fixed width, you can probably just set the NSTextView frame so it exactly fits 32 characters on a line. Then set the line breaking mode to wrap by character, eg:

        NSTextView* tv = whatever;
        NSTextStorage* ts = [tv textStorage];
NSMutableParagraphStyle* paraStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
        [paraStyle setLineBreakMode:NSLineBreakByCharWrapping];
[ts addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, [ts length])];
        [paraStyle release];

Warning: code typed into Mail without compiling/testing of any kind.

Hope that helps,

~Martin

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to