MDI VC++, How to pass parameters to view?
-
So, view may appear differently? I want to pass some parameter to view, these parameter is created at run time. So how can I pass them to view? A way to work arround is save those parameter in Doc. But it looks not quite right. I hope I can create CView::CView( int A, int B ) there is CView::Cview() already. so when template create view, pass A and B to view, so CView::CView( int A, int B ) is called, instaed of CView::CView( ). I was stuck, Please help me out. Thank you inadvance. :confused:
-
So, view may appear differently? I want to pass some parameter to view, these parameter is created at run time. So how can I pass them to view? A way to work arround is save those parameter in Doc. But it looks not quite right. I hope I can create CView::CView( int A, int B ) there is CView::Cview() already. so when template create view, pass A and B to view, so CView::CView( int A, int B ) is called, instaed of CView::CView( ). I was stuck, Please help me out. Thank you inadvance. :confused:
Storing it in the document does make since. You can pass additional information to the veiw of a particular document via OnUpdateAll(...,lHint,pHint). The lHint, argument can be long value (or a pointer value stored in a long). The pHint can be used if the addition information is stored in a CObject derive object. Good Luck! INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen
-
Storing it in the document does make since. You can pass additional information to the veiw of a particular document via OnUpdateAll(...,lHint,pHint). The lHint, argument can be long value (or a pointer value stored in a long). The pHint can be used if the addition information is stored in a CObject derive object. Good Luck! INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen
It would be easier to store it in document. In your view's OnDraw just call GetDocument() to get the document and then the parameter and simply write your drawing code depending on the parameter
-
It would be easier to store it in document. In your view's OnDraw just call GetDocument() to get the document and then the parameter and simply write your drawing code depending on the parameter
wwwrabbit1 already knows how to do that but wanted another way (to pass information to CView object) to accomplish the same thing and that is what the hint parameters are for. I personaly would contenue to store the information in the document, where it (probably) belongs. What we do not know is what effect the information is supposed to have, other than they effect what is to be shown. INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen