CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: CView

  1. #1
    Guest

    CView

    How to pass a parameter to the constructor of a CView ?
    Thanks in advance.


  2. #2
    Join Date
    May 1999
    Posts
    667

    Re: CView

    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


  3. #3
    Join Date
    Apr 1999
    Location
    France
    Posts
    35

    Re: CView

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured