On Apr 21, 2011, at 6:35 AM, Michael Dautermann wrote: > On Apr 18, 2011, at 5:37 AM, Дмитрий Николаев wrote: >> I need to implement custom separator with custom width between two part of >> paragraph in text view: >> >> AAAA AA A BBB BBBBB B >> >> This is separator must be included as non-editable character. So user can't >> delete it or modify. >> I understand, that i must overload standard behavior of textview in some >> points (for example, when user press "delete" right after separator nothing >> will be deleted) > > The potential user interface you're describing sounds quite scary. Are you > certain the end result is going to make sense to customers? > > But anyways, to get to where you want to be, look at the [NSTextViewDelegate > textView: shouldChangeTextInRange: replacementString:] method or -- since > you're likely to be subclassing NSTextView in order to do custom drawing of > whatever character / thing you're going to use as a separator -- you can also > look at [NSTextView shouldChangeTextInRange: replacementString:]. > > If these methods are called and the range crosses your "non-editable" > character, you can return NO and disallow the user from deleting anything > that includes that separator.
I agree with Michael that your proposed interface seems quite strange. Perhaps if we knew what you are trying to achieve we could propose a different solution. I can't tell if you are trying to separate a paragraph into left and right halves, adding arbitrary space after certain words or characters, or something else. Ross_______________________________________________ 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