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
Re: Dynamic allocation in MFC
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. :D