|
-
September 24th, 2003, 09:12 AM
#1
Dynamic CFormView ...
How would I go about creating one CFormView with multiple IDD_DIALOG templates.
I know I can use the AddDocTemplate() to add another document/view template, but how would I go about creating on class derived from "CFormView", and make this class use more than one IDD_DIALOG resource template.
eg.
IDD_PROJECT_FORM <- this will be my main dialog resources containing, and edit control, and a richtextctl
IDD_PROJECT_FORM2 <- this will be my second dialog resource, and upon the ID_FILE_NEW message I would "create" the relevant IDD_ form, but then again this form should link to both resources,
the normal enum decleration in the CFormView class ...
public:
//{{AFX_DATA(CXIRCView)
enum{ IDD = IDD_FORM_SERVER };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
could I go and change this enum decleration like follows ->
public:
//{{AFX_DATA(CXIRCView)
enum{ IDD = IDD_FORM_SERVER, IDD2 = IDD_FORMCLIENT };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
and then in the construction pass a variable to the view, I wish to create ? Instead of this ->
/////////////////////////////////////////////////////////////////////////////
// CProjectView construction/destruction
CXIRCView::CProjectView()
: CFormView(CProjectView::IDD)
{
I rather do this ->
/////////////////////////////////////////////////////////////////////////////
// CProjectView construction/destruction
CProjectView::CProjectView(int ViewType)
// this will be removed for generic view/dialog resource : //CFormView(CProjectView::IDD_CurrentView)
{
switch(ViewType)
{
case 0:
IDD_CurrentView = IDD_FORM_SERVER;
break;
case 1:
IDD_CurrentView = IDD_FORM_CLIENT;
break;
default:
break;
}
CFormView(CProjectView::IDD_CurrentView);
}
[b]where IDD_CurrentView will be the ID of the dialog resources to be used, and then I pass this in my construction ... ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|