2012-02-08 43 views
1

在我的MFC应用程序中,我使用CSplitterWnd创建了两个窗格,每个窗格都是一个CFormView对话框。运行此GUI应用程序时,分离器正在工作,并且两个窗格都显示,但所有控件(按钮,编辑框,组合框...)都被禁用。两个对话框都具有“孩子”和“无边界”的属性。分离器窗格上禁用了所有控件

我是否错过了在窗格视图中启用所有这些控制的内容?

非常感谢您的帮助。

CK

/////////// Header file 
class CParentSelectionDlg : public CFormView 
{ 
protected: 
    CParentSelectionDlg();   // protected constructor used by dynamic creation 
    DECLARE_DYNCREATE(CParentSelectionDlg) 

// Form Data 
public: 
    //{{AFX_DATA(CParentSelectionDlg) 
    enum { IDD = IDD_PARENT_SELECTION }; 
     // NOTE: the ClassWizard will add data members here 
    //}}AFX_DATA 

// Attributes 
public: 

// Operations 
public: 

// Overrides 
    // ClassWizard generated virtual function overrides 
    //{{AFX_VIRTUAL(CParentSelectionDlg) 
    public: 
    virtual void OnInitialUpdate(); 
    protected: 
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 
    //}}AFX_VIRTUAL 

// Implementation 
protected: 
    virtual ~CParentSelectionDlg(); 
#ifdef _DEBUG 
    virtual void AssertValid() const; 
    virtual void Dump(CDumpContext& dc) const; 
#endif 

    // Generated message map functions 
    //{{AFX_MSG(CParentSelectionDlg) 
    afx_msg void OnButtonSave(); 
    //}}AFX_MSG 
    DECLARE_MESSAGE_MAP() 
}; 


/////////////////////////////// CPP 

IMPLEMENT_DYNCREATE(CParentSelectionDlg, CFormView) 

CParentSelectionDlg::CParentSelectionDlg() 
    : CFormView(CParentSelectionDlg::IDD) 
{ 
    //{{AFX_DATA_INIT(CParentSelectionDlg) 
     // NOTE: the ClassWizard will add member initialization here 
    //}}AFX_DATA_INIT 
} 

CParentSelectionDlg::~CParentSelectionDlg() 
{ 
} 

void CParentSelectionDlg::DoDataExchange(CDataExchange* pDX) 
{ 
    CFormView::DoDataExchange(pDX); 
    //{{AFX_DATA_MAP(CParentSelectionDlg) 
     // NOTE: the ClassWizard will add DDX and DDV calls here 
    //}}AFX_DATA_MAP 
} 


BEGIN_MESSAGE_MAP(CParentSelectionDlg, CFormView) 
    //{{AFX_MSG_MAP(CParentSelectionDlg) 
    ON_BN_CLICKED(IDC_BUTTON_SAVE, OnButtonSave) 
    //}}AFX_MSG_MAP 
END_MESSAGE_MAP() 

///////////////////////////////////////////////////////////////////////////// 
// CParentSelectionDlg diagnostics 

#ifdef _DEBUG 
void CParentSelectionDlg::AssertValid() const 
{ 
    CFormView::AssertValid(); 
} 

void CParentSelectionDlg::Dump(CDumpContext& dc) const 
{ 
    CFormView::Dump(dc); 
} 
#endif //_DEBUG 

void CParentSelectionDlg::OnInitialUpdate() 
{ 
    CFormView::OnInitialUpdate(); 

} 


///////////////////////////////////////////////////////////////////////////// 
// CParentSelectionDlg message handlers 

void CParentSelectionDlg::OnButtonSave() 
{ 
    // TODO: Add your control notification handler code here 

} 
/// Thanks a lot 

回答

1

我敢打赌,你的message map没有设置正确。

你能发布你的代码吗?

+0

是的。我做到了。感谢您的回复。我尝试了其他对话框模板,并工作。对话框具有相同的属性。再次感谢您的帮助。 – 2012-02-08 22:41:26

+0

当我使用组合框并使用类向导添加变量后,控件全部启用。不知道为什么,但它现在起作用。欣赏你的表情。 – 2012-02-08 23:36:30

+0

VS做的事情你不能解释有时......好吧无论如何祝你好运:) – demoncodemonkey 2012-02-08 23:42:18