um... still stuck
how to init a modal dialog derived from CDialog? the constructor isn''t working... i just need to get it to load my dialog resource, how?
Here''s the steps from beginning to end:
1) Layout everything in the resource editor.
2) Hit Ctrl+W. This will bring up the class wizard.
3) New class.
4) Give it a name / filename. It creates code.
5) When you want to use one, run this code:
CYourDialogName dlg;
if (dlg.DoModal() == IDOK) {
// OK button pushed
}
else {
// cancel button pushed
}
This is the standard way to do dialogs in MFC. If this doesn''t work you can also do something like:
CYourDialogName dlg;
dlg.Create(CYourDialogName::IDD);
dlg.ShowWindow(SW_SHOW); // or something
...
but IIRC that''s mostly for modeless dialogs.
Mason McCuskey
Spin Studios - home of Quaternion, 2000 GDC Indie Games Fest Finalist!
www.spin-studios.com
1) Layout everything in the resource editor.
2) Hit Ctrl+W. This will bring up the class wizard.
3) New class.
4) Give it a name / filename. It creates code.
5) When you want to use one, run this code:
CYourDialogName dlg;
if (dlg.DoModal() == IDOK) {
// OK button pushed
}
else {
// cancel button pushed
}
This is the standard way to do dialogs in MFC. If this doesn''t work you can also do something like:
CYourDialogName dlg;
dlg.Create(CYourDialogName::IDD);
dlg.ShowWindow(SW_SHOW); // or something
...
but IIRC that''s mostly for modeless dialogs.
Mason McCuskey
Spin Studios - home of Quaternion, 2000 GDC Indie Games Fest Finalist!
www.spin-studios.com
Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
what i mean is:
i have a res and a dialog derived from cdialog
i''m not using da wizard
how do i get it to load that res?
if i were to do modeless, Create works, but what if i''m using DoModal(), how do i get it to load the res?
Thanks
i have a res and a dialog derived from cdialog
i''m not using da wizard
how do i get it to load that res?
if i were to do modeless, Create works, but what if i''m using DoModal(), how do i get it to load the res?
Thanks
AARGGH!!! STILL STUCK ON THIS STUPID #@*#&, please oh pretty please, how do i init the stupid dialog?
// This would be a simple OnOK() event from your main dlg
class CNewDlg : public CDialog
{
public:
CNewDlg( UINT nIdTemp ) : CDialog( nIdTemp )
{};
};
void CMainDlg::OnOK()
{
CNewDlg newDlg( IDD_YOUR_RESOURCE_ID_HERE );
newDlg.DoModal();
return;
}
Just one way, not the only way. I''m tired but this should get you going...
class CNewDlg : public CDialog
{
public:
CNewDlg( UINT nIdTemp ) : CDialog( nIdTemp )
{};
};
void CMainDlg::OnOK()
{
CNewDlg newDlg( IDD_YOUR_RESOURCE_ID_HERE );
newDlg.DoModal();
return;
}
Just one way, not the only way. I''m tired but this should get you going...
~deadlinegrunt
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement