CFormView constructor for multiples dialogs.
=?ISO-8859-1?Q?Guillermo_G=F3mez_Valc=E1rcel?= -- guille@baratz.es
Monday, December 02, 1996
Environment : Visual C++ 4.2b, Win 95, Win NT 3.51
I'm trying to create a class derived from CFormView but whos dialog can t=
o
be variable.
My design of class is :
CFormView
\
CMyBaseFormView
/ \
CMyFormVw1 CMyFormVw2
(Dialog 1) (Dialog 2)
=20
My problem lies with the MFC supplied constructor for CMyBaseFormView.
IMPLEMENT_DYNCREATE(CMyBaseFormView, CFormView)
CMyBaseFormView::CMyBaseFormView()
: CFormView(CMyBaseFormView::IDD) // I want variables IDDs, no
constant.
{
//{{AFX_DATA_INIT(CMyBaseFormView)
//}}AFX_DATA_INIT
}=20
My constructor derived class:
IMPLEMENT_DYNCREATE(CMyFormVw1,CMyBaseFormView)
CMyFormVw1::CMyFormVw1()
: CBaseFormView(CMyFormVw1::IDD) // I want pass IDD to MyBaseFormView=
=09
// constructor.
{
//{{AFX_DATA_INIT(CMyFormVw1)
//}}AFX_DATA_INIT
}=20
Any ideas?
Thanks for your help.
Guillermo G=F3mez Valc=E1rcel
Baratz, Servicios de Teledocumentaci=F3n, S.A.
<http://www.baratz.es>
Ian Pepper -- Ian@flexicom.ie
Wednesday, December 04, 1996
[Mini-digest: 6 responses]
Try:
class CMyBaseFormView : public CFormView
{
...
public:
CMyBaseFormView(UINT);
};
CMyBaseFormView::CMyBaseFormView(UINT id) : CFormView(id)
{
...
}
That is remove the IMPLEMENT_DYNCREATE(CMyBaseFormView, CFormView) and
DECLARE_DYNAMIC from the base class.
Hope this helps,
Ian
ian@flexicom.ie
>
>
-----From: kpandya@harbinger.net (Kanir Pandya)
This is how you do it.
Have another constructor for CBaseFormView() as follows
My problem lies with the MFC supplied constructor for CMyBaseFormView.
IMPLEMENT_DYNCREATE(CMyBaseFormView, CFormView)
CMyBaseFormView::CMyBaseFormView(int nIDD)
: CFormView(nIDD) // now nIDD is the variable.
constant.
{
//{{AFX_DATA_INIT(CMyBaseFormView)
//}}AFX_DATA_INIT
}=20
My constructor derived class:
IMPLEMENT_DYNCREATE(CMyFormVw1,CMyBaseFormView)
CMyFormVw1::CMyFormVw1()
: CBaseFormView(CMyFormVw1::IDD) // I want pass IDD to =
MyBaseFormView =09
// constructor.
{
//{{AFX_DATA_INIT(CMyFormVw1)
//}}AFX_DATA_INIT
}=20
----------
From: Guillermo G=F3mez Valc=E1rcel
Sent: Monday, December 02, 1996 4:35 AM
To: mfc-l@netcom.com
Subject: CFormView constructor for multiples dialogs.
Environment : Visual C++ 4.2b, Win 95, Win NT 3.51
I'm trying to create a class derived from CFormView but whos dialog can =
to
be variable.
My design of class is :
CFormView
\
CMyBaseFormView
/ \
CMyFormVw1 CMyFormVw2
(Dialog 1) (Dialog 2)
=20
My problem lies with the MFC supplied constructor for CMyBaseFormView.
IMPLEMENT_DYNCREATE(CMyBaseFormView, CFormView)
CMyBaseFormView::CMyBaseFormView()
: CFormView(CMyBaseFormView::IDD) // I want variables IDDs, no
constant.
{
//{{AFX_DATA_INIT(CMyBaseFormView)
//}}AFX_DATA_INIT
}=20
My constructor derived class:
IMPLEMENT_DYNCREATE(CMyFormVw1,CMyBaseFormView)
CMyFormVw1::CMyFormVw1()
: CBaseFormView(CMyFormVw1::IDD) // I want pass IDD to =
MyBaseFormView =09
// constructor.
{
//{{AFX_DATA_INIT(CMyFormVw1)
//}}AFX_DATA_INIT
}=20
Any ideas?
Thanks for your help.
Guillermo G=F3mez Valc=E1rcel
Baratz, Servicios de Teledocumentaci=F3n, S.A.
<http://www.baratz.es>
-----From: Todd Davis
There's no law saying you HAVE to use the MFC supplied constructor for
CMyBaseFormView. Instead, supply your own that takes a UINT parameter, pass
that UINT right on up the chain into CFormView, and you should be good to=
go.
Right off the top of my head, I don't know if you're going to have problems
because of the IMPLEMENT_DYNCREATE, but make sure you make your new
constructor public.
Todd Davis
At 10:35 AM 12/2/96 +0100, you wrote:
>Environment : Visual C++ 4.2b, Win 95, Win NT 3.51
>
>I'm trying to create a class derived from CFormView but whos dialog can to
>be variable.
>My design of class is :
>
> CFormView
> \
> CMyBaseFormView
> / \
>CMyFormVw1 CMyFormVw2
>(Dialog 1) (Dialog 2)
>=20
>My problem lies with the MFC supplied constructor for CMyBaseFormView.
>
>IMPLEMENT_DYNCREATE(CMyBaseFormView, CFormView)
>
> CMyBaseFormView::CMyBaseFormView()
> : CFormView(CMyBaseFormView::IDD) // I want variables IDDs, no
>constant.
> {
> //{{AFX_DATA_INIT(CMyBaseFormView)
> //}}AFX_DATA_INIT
> }=20
>
>My constructor derived class:
>
>IMPLEMENT_DYNCREATE(CMyFormVw1,CMyBaseFormView)
>
> CMyFormVw1::CMyFormVw1()
> : CBaseFormView(CMyFormVw1::IDD) // I want pass IDD to MyBaseFormView =
=09
> // constructor.
> {
> //{{AFX_DATA_INIT(CMyFormVw1)
> //}}AFX_DATA_INIT
> }=20
>
>Any ideas?
>Thanks for your help.
>
>Guillermo G=F3mez Valc=E1rcel
>Baratz, Servicios de Teledocumentaci=F3n, S.A.
>
><http://www.baratz.es>
>
>
>
----------------------------------------------------
at home... http://www.idir.net/~tigger
at work... davistod@gw2k.com
at play... tigger@idir.net
----------------------------------------------------
-----From: "Ronald D. Patton"
Nothing keeps you from adding a default argument to the existing
constructor or
adding another constructor that will take the dialog id and pass it along
to the
CFormView constructor.
Hope this helps,
Ron Patton
----------
> From: Guillermo G=F3mez Valc=E1rcel
> To: mfc-l@netcom.com
> Subject: CFormView constructor for multiples dialogs.
> Date: Monday, December 02, 1996 3:35 AM
>=20
> Environment : Visual C++ 4.2b, Win 95, Win NT 3.51
>=20
> I'm trying to create a class derived from CFormView but whos dialog can
to
> be variable.
> My design of class is :
>=20
> CFormView
> \
> CMyBaseFormView
> / \
> CMyFormVw1 CMyFormVw2
> (Dialog 1) (Dialog 2)
> =20
> My problem lies with the MFC supplied constructor for CMyBaseFormView.
>=20
> IMPLEMENT_DYNCREATE(CMyBaseFormView, CFormView)
>=20
> CMyBaseFormView::CMyBaseFormView()
> : CFormView(CMyBaseFormView::IDD) // I want variables IDDs, no
> constant.
> {
> //{{AFX_DATA_INIT(CMyBaseFormView)
> //}}AFX_DATA_INIT
> }=20
>=20
> My constructor derived class:
>=20
> IMPLEMENT_DYNCREATE(CMyFormVw1,CMyBaseFormView)
>=20
> CMyFormVw1::CMyFormVw1()
> : CBaseFormView(CMyFormVw1::IDD) // I want pass IDD to MyBaseFormVi=
ew
=09
> // constructor.
> {
> //{{AFX_DATA_INIT(CMyFormVw1)
> //}}AFX_DATA_INIT
> }=20
>=20
> Any ideas?
> Thanks for your help.
>=20
> Guillermo G=F3mez Valc=E1rcel
> Baratz, Servicios de Teledocumentaci=F3n, S.A.
>
> <http://www.baratz.es>
>=20
-----From: Vincent Mascart <100425.1337@CompuServe.COM>
>From: "=?ISO-8859-1?Q?Guillermo_G=F3mez_Valc=E1rcel?="
>Sent: mercredi 4 decembre 1996 6:41
>Subject: CFormView constructor for multiples dialogs.
>
>Environment : Visual C++ 4.2b, Win 95, Win NT 3.51
>
>I'm trying to create a class derived from CFormView but whos dialog can't be
variable.
>My design of class is :
>
> CFormView
> \
> CMyBaseFormView
> / \
>CMyFormVw1 CMyFormVw2
<(Dialog 1) (Dialog 2)
>
>My problem lies with the MFC supplied constructor for CMyBaseFormView.
>
>IMPLEMENT_DYNCREATE(CMyBaseFormView, CFormView)
>
> CMyBaseFormView::CMyBaseFormView()
> : CFormView(CMyBaseFormView::IDD) // I want variables IDDs, no
>constant.
> {
> //{{AFX_DATA_INIT(CMyBaseFormView)
> //}}AFX_DATA_INIT
> }
>
>My constructor derived class:
>
>IMPLEMENT_DYNCREATE(CMyFormVw1,CMyBaseFormView)
>
> CMyFormVw1::CMyFormVw1()
> : CBaseFormView(CMyFormVw1::IDD) // I want pass IDD to MyBaseFormView=
>
> // constructor.
> {
> //{{AFX_DATA_INIT(CMyFormVw1)
> //}}AFX_DATA_INIT
> }
>
>Any ideas?
>Thanks for your help.
That's piece of cake.
Nothing prevent you to modify the constructor CMyBaseFormView like :
CMyBaseFormView::CMyBaseFormView(UINT nID) : CFormView(nID)
Vincent Mascart
100425.1337@compuserve.com
-----From: cugr1@gd.swissptt.ch (Cunningham Graham, IT347)
Well assuming that you dont want your class to be instantiated.
1. Use the IMPLEMENT_DYNAMIC/DECLARE_DYNAMIC pair
2. Have a constructor defined as below.
CMyBaseFormView::CMyBaseFormView(UINT nIDTemplate) : =
CFormView(nIDTemplate)
=7B
=7D
If you are still having problems take a look at how CFormView itslef is =
implemented as this is a class that cannot be instantiated and derives =
from I think CScrollView.
----------
Von: Guillermo G=F3mez Valc=E1rcel=5BSMTP:guille=40baratz.es=5D
Gesendet: Montag, 2. Dezember 1996 10:35
An: mfc-l=40netcom.com
Betreff: CFormView constructor for multiples dialogs.
Environment : Visual C++ 4.2b, Win 95, Win NT 3.51
I'm trying to create a class derived from CFormView but whos dialog can =
to
be variable.
My design of class is :
CFormView
=5C
CMyBaseFormView
/ =5C
CMyFormVw1 CMyFormVw2
(Dialog 1) (Dialog 2)
=
My problem lies with the MFC supplied constructor for CMyBaseFormView.
IMPLEMENT_DYNCREATE(CMyBaseFormView, CFormView)
CMyBaseFormView::CMyBaseFormView()
: CFormView(CMyBaseFormView::IDD) // I want variables IDDs, no
constant.
=7B
//=7B=7BAFX_DATA_INIT(CMyBaseFormView)
//=7D=7DAFX_DATA_INIT
=7D
My constructor derived class:
IMPLEMENT_DYNCREATE(CMyFormVw1,CMyBaseFormView)
CMyFormVw1::CMyFormVw1()
: CBaseFormView(CMyFormVw1::IDD) // I want pass IDD to MyBaseFormView =
=
=
// constructor.
=7B
//=7B=7BAFX_DATA_INIT(CMyFormVw1)
//=7D=7DAFX_DATA_INIT
=7D
Any ideas?
Thanks for your help.
Guillermo G=F3mez Valc=E1rcel
Baratz, Servicios de Teledocumentaci=F3n, S.A.
<http://www.baratz.es>
| Вернуться в корень Архива
|