MFC Newbie design question
- From: brm@xxxxxxxxxxxxxxxxxxx (Ben)
- Date: 14 Apr 2005 03:04:49 -0700
Hi All,
I'm putting together an MFC app (SDI) that allows the
loading/editing/saving of an XML document.
The MSXML document will be stored as a reference in the Document
class.
The loaded (XML) document will be displayed in a TreeView.
To ease editing I was thinking about using SetItemData() to map a node
in the TreeView against its corresponding node in the XML document (by
storing a reference to the XML node against the TreeView node).
The user can then manipulate the DOM by selecting a node in the
treeview, changing it's attributes etc.
I have a slight chicken/egg problem though.
In Document::Serialize() I need to release the existing MSXML document
and clear down the existing treeview BEFORE loading a new document.
But I can't ->Release() the old MSXML document because its referenced
by nodes in the old tree.
So I think i have to firstly, delete all the items in the treeview, by
iterating though each item, calling GetItemData(), casting it back to
a smart pointer, calling release on the MSXML Node (smart pointer).
Then call DeleteAllItems() on the TreeCtrl, then release the MSXML
document.
I think I need to do this in Document::Seriliaze() prior to loading
the new document.
Does this sound right?
Many thanks in advance,
Ben.
.
- Follow-Ups:
- Re: MFC Newbie design question
- From: KMA
- Re: MFC Newbie design question
- From: David Lowndes
- Re: MFC Newbie design question
- Prev by Date: VC++ 6 Font
- Next by Date: changing the application name
- Previous by thread: VC++ 6 Font
- Next by thread: Re: MFC Newbie design question
- Index(es):