急问:属性页里的消息问题,急!!急!!急!!急!!!急!!!

gyj86 2005-12-20 10:25:24
问:我作了一个标签对话框,里面放了两个属性页对话框:IDD_TIMECLOCK_DIALOG,IDD_DIALOGTAB2
部分代码如下所示:
CSheet dlg("ddddddd");
CPropertyPage Page1(IDD_TIMECLOCK_DIALOG),Page2(IDD_DIALOGTAB2);
dlg.AddPage(&Page1);
dlg.AddPage(&Page2);
dlg.EnableStackedTabs(FALSE);
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();

注:class CSheet : public CPropertySheet
可为什么IDD_TIMECLOCK_DIALOG,IDD_DIALOGTAB2
对话框里的消息映射都消失了呀,例如:IDD_TIMECLOCK_DIALOG 对话框里的 点击按钮事件,,单独对话框弹出的时候,对话框里的 点击按钮事件是存在的,可IDD_TIMECLOCK_DIALOG 对话框放到CSheet标签对话框里时,点击按钮事件消失了呀,为什么???急!!急!!急!!急!!!急!!!
...全文
89 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
laofang 2005-12-21
  • 打赏
  • 举报
回复
你是不是把IDD_TIMECLOCK_DIALOG,IDD_DIALOGTAB2都映射成对话框类了,而不是CPropertyPage 类?

如果是这样的话,肯定是不行的。
flyelf 2005-12-21
  • 打赏
  • 举报
回复
CPropertyPage Page1(IDD_TIMECLOCK_DIALOG),Page2(IDD_DIALOGTAB2);// 按钮点击事件不在CPropertyPage中,消息映射在你通过向导生成的类中
gyj86 2005-12-21
  • 打赏
  • 举报
回复
我把IDD_TIMECLOCK_DIALOG,IDD_DIALOGTAB2都映射成CPropertyPage,可还是不行呀


CPropertyPage Page1(IDD_TIMECLOCK_DIALOG),Page2(IDD_DIALOGTAB2);// 按钮点击事件不在CPropertyPage中,消息映射在你通过向导生成的类中
我的消息事件是在我向导生成的类中呀
下边是我重新测试的一基于CPropertyPage类的对话框,我把它放在CSheet中,OnButton1()事件没有反映
CProp1::CProp1() : CPropertyPage(CProp1::IDD)
{
//{{AFX_DATA_INIT(CProp1)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}

CProp1::~CProp1()
{
}

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


BEGIN_MESSAGE_MAP(CProp1, CPropertyPage)
//{{AFX_MSG_MAP(CProp1)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CProp1 message handlers

void CProp1::OnButton1()
{
// TODO: Add your control notification handler code here
MessageBox("s","sdf",1);
}





CSheet::CSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
// Page1.Construct(IDD_TIMECLOCK_DIALOG);
// Page2.Construct(IDD_DIALOGTAB2);
// AddPage(&Page1);
// AddPage(&Page2);
//SetActivePage(&Page1);
}

CSheet::CSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{

}

CSheet::~CSheet()
{
}


BEGIN_MESSAGE_MAP(CSheet, CPropertySheet)
//{{AFX_MSG_MAP(CSheet)
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSheet message handlers

BOOL CSheet::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
MessageBox("sdf","sdf",1);
return CPropertySheet::OnCommand(wParam, lParam);
}

void CSheet::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
MessageBox("sdf","sdf",1);
CPropertySheet::OnKeyDown(nChar, nRepCnt, nFlags);
}



vcmute 2005-12-20
  • 打赏
  • 举报
回复
不应该,dlg李的代码呢

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧