doc/view ???
-
Hi, I'm trying to create a little program, wich basicaly reads a file. I already have written some code in the serializing-fuction, wich reads the data. I now would like to add a progress bar and some info-text in my window (CFormView). I don't know how to get data from the doc class to the view class. Has it something to do with messages? I'm new at all of this stuff, so its very confusing... Thank's in advance!
-
Hi, I'm trying to create a little program, wich basicaly reads a file. I already have written some code in the serializing-fuction, wich reads the data. I now would like to add a progress bar and some info-text in my window (CFormView). I don't know how to get data from the doc class to the view class. Has it something to do with messages? I'm new at all of this stuff, so its very confusing... Thank's in advance!
You can simply use CDocument's
GetFirstViewPosition()
andGetNextView()
to access the desired view. An alternative for frame windos is callingAfxGetMainWnd()->GetActiveView()
, which gives you access to the current view.
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
-
Hi, I'm trying to create a little program, wich basicaly reads a file. I already have written some code in the serializing-fuction, wich reads the data. I now would like to add a progress bar and some info-text in my window (CFormView). I don't know how to get data from the doc class to the view class. Has it something to do with messages? I'm new at all of this stuff, so its very confusing... Thank's in advance!
Plons wrote: I don't know how to get data from the doc class to the view class. After the document has successfully loaded the file, simply call
UpdateAllViews()
to notify the view that it needs to display new information. In the view'sOnUpdate()
method, it will ask the document (usually viaGetDocument()
and one other method) for the data to be displayed. Check out the Scribble tutorial on MSDN. It goes over serialization, and doc/view in great detail.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen