Skip navigation.
 
mlRe: NSTextView, style, and weird Core Data issue
FROM : I. Savant
DATE : Wed Jul 26 22:34:19 2006

Matt:

> (1) I don't like it, because here I was working happily in the 
> model and
> suddenly I'm supposed to reach out and munge the view? Isn't the 
> whole point
> of having the NSTextView bound thru to Core Data that it should do 
> all this
> automatically?
>

  Here be dragons. :-)

  First, (and I'm sure you're aware and it was a slip of the tongue, 
but for archival purposes...) be careful not to equate Core Data to 
Bindings. Both are separate, though they do (and are intended to) 
work together quite nicely.

  Second, Bindings does not completely negate the need for your own 
controller layer in most non-academic projects. Sure, it replaces a 
*lot* of code, but there are more times than not that I still have to 
intercede a bit. Is that the case here? Maybe not, it could very well 
be a bug (more on this below). Frequently, I have to wire an "add" 
button to a custom action rather than directly to an 
NSArrayController's -add: action because I need to do some additional 
interface diddling. That's what the controller layer is there for, to 
mediate between the model and view layers, so this is not really 
"wrong", it's just damned inconvenient. :-) Especially after being 
spoiled with Bindings in 10.3 and Core Data in 10.4 ...

> (2) If this is necessary, then why does it work properly when the 
> attributed
> string consists of a space? Clearly in that case the text view *does*
> "reset" the typing attributes just because the underlying text store
> changed. And the NSTextView does have "default" attributes, after a 
> fashion,
> so yes, I would have expected that emptying out the text storage 
> *would*
> reset the typing attributes (to the NSTextView's default attibutes).
>
> I guess what I'm saying is, that's a great suggestion, but at the 
> same time,
> is there a case to be made that the behavior I'm seeing is 
> unexpected (i.e.
> wrong)? m.
>

  My own line of thinking (if I saw what you're seeing) would be 
that it's actually rather logical since there's no specific / direct 
way of setting "default" typing attributes for a text view and 
there's no strictly defined behavior (that I remember reading of) 
that dictates how or when the attributes would revert to default.

> PS The really interesting thing about your idea here is that it 
> seems to
> imply that this has nothing to do with Core Data - that emptying an
> NSTextView's text storage doesn't reset the current typing 
> attributes. That
> is an hypothesis I'll have to test.


  Perhaps I'm wrong, but I thought this to be the case - emptying a 
text view's text storage does not reset typing attributes. I'm wrong 
often, so there's hope for you yet! :-)

  Let me know what you find in your testing - if I'm wrong, I'd love 
to know!

--
I.S.

Related mailsAuthorDate
mlNSTextView, style, and weird Core Data issue Matt Neuburg Jul 26, 21:15
mlRe: NSTextView, style, and weird Core Data issue I. Savant Jul 26, 21:21
mlRe: NSTextView, style, and weird Core Data issue I. Savant Jul 26, 21:24
mlRe: NSTextView, style, and weird Core Data issue Matt Neuburg Jul 26, 22:22
mlRe: NSTextView, style, and weird Core Data issue I. Savant Jul 26, 22:34
mlRe: NSTextView, style, and weird Core Data issue I. Savant Jul 26, 22:42
mlRe: NSTextView, style, and weird Core Data issue Matt Neuburg Jul 27, 02:52
mlRe: NSTextView, style, and weird Core Data issue Martin Wierschin Jul 27, 09:27
mlRe: NSTextView, style, and weird Core Data issue Matt Neuburg Jul 27, 15:41
mlRe: NSTextView, style, and weird Core Data issue Matt Neuburg Jul 28, 01:30
mlRe: NSTextView, style, and weird Core Data issue Martin Jul 28, 02:04