CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2006
    Location
    Croatia - Zagreb
    Posts
    459

    Dynamic allocation in MFC

    Why doesn't MFC supports dynamic creation of controls? I have found my self in many situations, where this feature would help a lot and simplify program design. (perticular in simple dialogs, where user is asked to input some data).
    In that way it would be possible to create truely dynamic programs.
    By this question I meen to avoid, common post on VC++ section of CodeGuru forums witch is: "Just create 10-50 CEdit controls on dialog, and hide them, when you need them use ShowWindow(SW_SHOW)". I greatly dissagree with this programming practice.
    And another question is easy one but I haven't found an answer yet. It is about class view in VC++. I have a problem where I add some project files, like FastObject's hxx file or MySQL or anything, and it automatically includes all classes and function found in it, and then class view is usselles couse there's just too many functions and classess, Is there a way to avoid that?

    Regards:
    Dario Maljur
    You just divided by zero, didn't you?

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Dynamic allocation in MFC

    [ Moved ]
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: Dynamic allocation in MFC

    Quote Originally Posted by Odiee
    Why doesn't MFC supports dynamic creation of controls?
    Well, it does.
    I am not sure what do you mean by dynamic creation.
    1. It may mean instantiation of the object at the compile time and window creation at the run time.
    2. Object instantiation and window creation at the run time.

    Both are supported therefore I am not sure what is your question referring to.
    Quote Originally Posted by Odiee
    By this question I meen to avoid, common post on VC++ section of CodeGuru forums witch is: "Just create 10-50 CEdit controls on dialog, and hide them, when you need them use ShowWindow(SW_SHOW)". I greatly dissagree with this programming practice.
    Why? I fail to see what is wrong with it.
    Quote Originally Posted by Odiee
    And another question is easy one but I haven't found an answer yet.
    Unfortunately that is true and there is nothing you can do about it. That is the way calss view was designed.
    Quote Originally Posted by Odiee
    Why can't CButton and CEdit be dynamically allocated. . .
    They can.
    Quote Originally Posted by Odiee
    and why did I just spent 54 minutes on implementing Popup menu?
    you should be able to answer this question.
    You are probably in the process of learning how to do it. It takes me about 2 minutes.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

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