Re: Right way to build style sheets?
Re: Right way to build style sheets?
- Subject: Re: Right way to build style sheets?
- From: Douglas Davidson <email@hidden>
- Date: Wed, 13 Nov 2002 12:16:04 -0800
On Wednesday, November 13, 2002, at 11:54 AM, Steve Mykytyn wrote:
I need to keep a list of styles for text: font, size, style, color,
etc.
for the user interface, i'd like to have the user simply change
any/all of those for a fixed string of text, like "Sample", or perhaps
have the text change in response to the chosen attributes, e.g.
"Helvetica 24 bold".
Is it possible to have an NSTextView where users can edit attributes
but not text? I'm guessing not...
If you give your NSTextView a delegate, the delegate can approve or
deny any changes the user may make. It should be fairly
straightforward to allow only those changes that modify
attributes--something like this (untested):
- (BOOL)textView:(NSTextView *)textView
shouldChangeTextInRange:(NSRange)affectedCharRange
replacementString:(NSString *)replacementString {
// Delegate only. If characters are changing, replacementString is
what will replace the affectedCharRange. If attributes only are
changing, replacementString will be nil.
return (replacementString == nil);
}
_______________________________________________
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.