Problem: 1338821

Title: (Views) TEditText does not mark fDocument as changed

Received: Apr 8 1996 10:17AM


TEditText does not mark fDocument as changed...
...because the floating TEView never has it's fDocument field set to the fDocument of the TEditText it is installed into.

I think it should, and in tracking down why it does not, I think that TView has a bug in it:

It could be done in TEditText::InstallFloatingTEView, and undone in TEditText::RemoveFloatingTEView, but really, shouldn't TView::AddSubView and TView::RemoveSubView being doing this automatically?


Fix:

Originally added updates to fDocument in AddSubView and RemoveSubView, as suggested but one of our developers reported getting crashing bugs because of the changes. ("What I'm doing is kinda wierd -- I've got subviews with different documents than their superviews, but it was ok in MacApp until now. Basically, I think I should be able to control what document my views belong to and not have MacApp change it on me. The change to RemoveSubView is the real killer -- just because I'm pulling the subview out of the view hierarchy doesn't mean I want MacApp to set its fDocument to NULL. Especially in my case, where my subview has a different fDocument than its superview.") TDialogTEView having fDocument NULL is a special case because it is made by the floating TE manager, and it can't tell what document the TEView should belong to. That's ok. All we need is two calls to BeInDocument in TDialogTEView::InstallEditText. The right way to fix the problem is with a band-aid -- not major surgery.

Final resolution: I backed out the changes to TView::AddSubView and RemoveSubView. Instead of setting fDocument there, I changed TDialogTEView::InstallEditText to call BeInDocument and RemoveFromDocument when the floating TE is installed and deinstalled, respectively.