How to pass a parameter to the constructor of a CView ?
Thanks in advance.
Printable View
How to pass a parameter to the constructor of a CView ?
Thanks in advance.
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
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