Using CFormView in SDI app
-
Hi, I have a CFormView-based SDI project in which I need to programmatically create & update an array of buttons in a view window. It seems that a CFormView would be the best class to use for this window, but I can't seem to create the window. What type of parent should the window have? I need to create it in the app's main CFormView window. Can that be done? Can anyone point me to a sample project? Thanks, Royce
-
Hi, I have a CFormView-based SDI project in which I need to programmatically create & update an array of buttons in a view window. It seems that a CFormView would be the best class to use for this window, but I can't seem to create the window. What type of parent should the window have? I need to create it in the app's main CFormView window. Can that be done? Can anyone point me to a sample project? Thanks, Royce
-
-
You cannot create child controls in the constructor, because the window is not created yet. You see, the CFormView object is nothing but a wrapper around a HWND (window handle). You will have much better luck if you create the child controls in OnInitialUpdate() (that is a virtual method which you can override, and is found in the classwizard). All MFC window/control* classes are only wrappers around window handles, they are not windows themselves. They merely present a C++-friendly interface (some may disagree with this) to the messaging protocols which the window supports. -- Pictures[^] from my Japan trip. -- modified at 8:56 Sunday 4th December, 2005
-
You cannot create child controls in the constructor, because the window is not created yet. You see, the CFormView object is nothing but a wrapper around a HWND (window handle). You will have much better luck if you create the child controls in OnInitialUpdate() (that is a virtual method which you can override, and is found in the classwizard). All MFC window/control* classes are only wrappers around window handles, they are not windows themselves. They merely present a C++-friendly interface (some may disagree with this) to the messaging protocols which the window supports. -- Pictures[^] from my Japan trip. -- modified at 8:56 Sunday 4th December, 2005
Jörgen Sigvardsson wrote:
They merely present a C++-friendly interface (some may disagree with this)
Aw, don't spoil his fun, Jörgen :-D.
Software Zen:
delete this;
-
Jörgen Sigvardsson wrote:
They merely present a C++-friendly interface (some may disagree with this)
Aw, don't spoil his fun, Jörgen :-D.
Software Zen:
delete this;