CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2010
    Posts
    34

    Insert Common Control into View Dynamically

    Hi,

    This is what I try to achieve:
    1. Using a CScrollView as the View class type.
    2. Using Document/View Architecture.
    3. Insert multiple Common Controls such as CEdit, CButton, CListCtrl into the View dynamically.
    4. All the Common Controls is base on a template created by user. So I do not know the quantity of the Common Controls.

    This is the plan on how to do it:
    1. In View OnInitialUpdate(), read the template to get all necessary info on the Common Controls to be create.
    2. In View OnInitialUpdate(), create all Common Control. Some Common Control may not have WS_VISIBLE as it may not needed at initial stage.
    3. In View OnUpdate(), I need to refresh the Common Control properties such as is its text, position or its visibility. This should happen if Document call UpdateAllView().

    My Question:
    1. Is this a normal & useable plan?
    2. Do I miss other functions for any other messages?
    3. Still wondering if I need to involve any coding in OnDraw() for this plan.

    I’m not a professional programmer, only an engineer.
I hope I does not bored you guys to death with my questions.
    Hehe.

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: Insert Common Control into View Dynamically

    It's probably easier to put the controls on a dialog (dynamically) and use a CFormView.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

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