Click to See Complete Forum and Search --> : CView


June 7th, 1999, 07:05 AM
How to pass a parameter to the constructor of a CView ?
Thanks in advance.

ChrisD
June 7th, 1999, 09:11 AM
You can't Views are constructed using dynamic creation which has no parameters, we use a call back to the doc in OnInitialUpdate and store the needed information there just before creating the view.

HTH,
Chris

B. Colombet
June 7th, 1999, 09:13 AM
A constructor can take parameters but you have to implement a base constructor anyway.

void MyView::MyView()
{
}

void MyView::MyView(int Param)
{
m_param = Param;
}




C++ will call the correct constructor mechanism for you.

Anyway, you'll see that the constructor if not often a good place to initalize variables members of the view.
It's sometimes better to do that in OnInitialUpdate() or this kind of messages you can intercept.


C++ developer
Faculté de Médecine
27 Bd Jean Moulin
13385 Marseille cedex 05