15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Any Caveats using Views without Documents

wtflanders@micron.com
Friday, December 06, 1996

Environment: VC++ 4.2b, Win NT 4.0

I have a specialize tree view class I created for a previous app and would like
to use it in a new app.  The new app's use of the tree view will be to display a
contents of all open documents and their data, thus any one doc will not own the
view.  I'd also like to use CEditView in a similar manner for an output window.

Is there any problems using CView derived classes that aren't attached to a
specific document?  

Since CViews delete themselves delete causes an assert, should I call 
OnNCDestroy when I want them to delete unattached views?

AtDhVaAnNkCsE.



Paul Cook -- pxc@kid01pml.icl.co.uk
Tuesday, December 10, 1996

[Mini-digest: 2 responses]

>
> I'd also like to use CEditView in a similar manner for an output window.
>
> Is there any problems using CView derived classes that aren't attached to a
> specific document?

I used CEditView without a doc in VC++1.0 and had problems with the default
print code. The framework wanted to get at the document name via the view. I
gave the view a dummy document (empty title) for the duration of the 
print/preview.  The same workaround is still in my VC++4.0 project.  I havent 
tried taking it out yet.  Maybe it works ok without it now.

Paul.
-----From: "Arthur H. Warren" 

>Environment: VC++ 4.2b, Win NT 4.0
>
>I have a specialize tree view class I created for a previous app and would
>like to use it in a new app.  The new app's use of the tree view will be to
>display a contents of all open documents and their data, thus any one doc
will 
>not own the view.  I'd also like to use CEditView in a similar manner for an
>output window.
>
>Is there any problems using CView derived classes that aren't attached to a
>specific document?

>From the fluffier standpoint of design, I guess that I'd consider the
source of data (list of open documents) a document. You'll have a class
that will presumably manage this list, so it seems like a "good thing" to
use that as your document class for the tree view (deriving from CDocument,
of course). I used to get hung up on having a physical document (file or
some such) for a document class - 'taint necessary.

Herb.


 ________________________________________________________________________
 Herb Warren - Junior G-Man, Rocket Scientist.  AM/FM/GIS Services
 James W Sewall Company                         Voice:  207-827-4456
 147 Center Street                              Fax:    207-827-3641
 Old Town, Maine 04468                          Email:  awarren@jws.com
_________________________________________________________________________




| Вернуться в корень Архива |