Multi-view desktop serialization
Ruben Bartelink SCP24001 -- SCP24001@novell1.rtc-carlow.ie
Tuesday, February 13, 1996
This is I am sure a very FAQqy question, but, it aint in no FAq, so
here goes:
I am attempting to serialise my desktop through my Documetn class.
In other words, the document is to store the states of the multiple
views attached to it. The view list of the document appears to be
CObject-derived. Alas, serializing it in the Doc's Serialize
function doesnt yield the correct results.
Basically, is there a simple way to serialise the view list of a
document ???
TIA
Ruben Bartelink email: scp24001@rtc-carlow.ie
BSc Software Engineering
RTC Carlow "The advantage of being Mottoless
Carlow is to be able to make it up as
Ireland one goes along" -- R.B. (1995)
Jim Lavin -- ooptech@Onramp.NET
Thursday, February 15, 1996
Ruben Bartelink wrote:
>
> This is I am sure a very FAQqy question, but, it aint in no FAq, so
> here goes:
>
> I am attempting to serialise my desktop through my Documetn class.
> In other words, the document is to store the states of the multiple
> views attached to it. The view list of the document appears to be
> CObject-derived. Alas, serializing it in the Doc's Serialize
> function doesnt yield the correct results.
>
> Basically, is there a simple way to serialise the view list of a
> document ???
>
> TIA
>
> Ruben Bartelink email: scp24001@rtc-carlow.ie
> BSc Software Engineering
> RTC Carlow "The advantage of being Mottoless
> Carlow is to be able to make it up as
> Ireland one goes along" -- R.B. (1995)
Your best bet is to add code to your document's Serialize() member
function. This code should walk throught the list of views that are
currently open and request the information you wish to keep; i.e. size,
type etc. Once you get the data serialize it out along wth the rest of
the document.
The tricky part is when you serialize the document in. You just can't
go creating views in the middle of the document's serailize function.
You will probably need to keep an internal array to hold each view's
data until a time comes where you can create the views. Usually you
can post a message to the App which would then get the information from
the document and start creating views. As each view is created, they
would then request the sizing information from the document and resize
themselves.
Hope this sets you down the right path
[Moderator's note: There were several answers to this question,
but for some reason, most people didn't quite understand the
question. Ruben wasn't asking how to serialize a view object, he
was asking how to save their states - he even specified "states".
The idea is similar to what MSDEV does: a project workspace remembers
what windows you had up and where you had them. I think Jim's answer
here is right on the mark.]
Mike Blaszczak -- mikeblas@msn.com
Wednesday, February 28, 1996
> The view list of the document appears to be
> CObject-derived. Alas, serializing it in the Doc's Serialize
> function doesnt yield the correct results.
No, it wouldn't. This list isn't designed to be serialized.
> Basically, is there a simple way to serialise the view list of a
> document ???
If you mean "is there a way to make one call and have everything be serialized
for me", no there isn't.
It _is_ pretty easy to rip through the list of items in that list, though. You
can go through the list and serialize the bits of information that you want to
store for each element. I'm not sure what "states" you want to store for each
one, but you could just write it out in that loop.
When you're serializing to load, you'll need to get those bits of information
back. But before you can do anything with them, you'll need to recreate the
view, frame, and documents associated with each item. If the document that
you're serializing is the one holding this same information, you're going to
have some interesting work ahead of you.
Your best bet, if that's what you want, would probably be to store the state
information in the document at least temporarily. Then, when the views are
each created, you could have the view ask the document for the status it
should assume.
.B ekiM
TCHAR szDebugging[] = _T("Is this _supposed_ to be NULL?");
----------
From: owner-mfc-l@netcom.com on behalf of Ruben Bartelink
Sent: Tuesday, February 13, 1996 07:12
To: mfc-l@netcom.com
Subject: Multi-view desktop serialization
This is I am sure a very FAQqy question, but, it aint in no FAq, so
here goes:
I am attempting to serialise my desktop through my Documetn class.
In other words, the document is to store the states of the multiple
views attached to it. The view list of the document appears to be
CObject-derived. Alas, serializing it in the Doc's Serialize
function doesnt yield the correct results.
Basically, is there a simple way to serialise the view list of a
document ???
TIA
Ruben Bartelink email: scp24001@rtc-carlow.ie
BSc Software Engineering
RTC Carlow "The advantage of being Mottoless
Carlow is to be able to make it up as
Ireland one goes along" -- R.B. (1995)
| Вернуться в корень Архива
|