|
-
July 12th, 1999, 05:25 AM
#1
Message from a dialog
Hi,
Is it possible to get a button in a dialog to return a value to the view in a similar way to the OK and CANCEL buttons in a dialog?
I have placed a button in a dialog, called IDC_BUTTON_1 for example, and I would like to be able to do something like:
int response = dlg.DoModal();
if (responce == IDBUTTON1)
{
// Button 1 has been pressed.
}
if (response == IDOK)
{
// The OK button was pressed.
}
in the View i.e. once the button is pressed the dialog finishes (exactly as if OK had been pressed) and the View is given an opportunity to proceed with appropriate calculations.
Can anybody point me in the right direction to do this?
Thanks in advance
Dave
-
July 12th, 1999, 05:57 AM
#2
Re: Message from a dialog
Hi
Your button should close the dialog, using EnDialog:
void CMyDialog::OnButton1()
{
// your stuff
EndDialog(IDC_BUTTON1);
}
this assumes that IDC_BUTTON1 exists, that is typically the ID associated to your button.
It is EndDialog that send the relevant message
HTH
Yves Le Sant
Metrology and Measurement Unit
Fundamental and Experimental Aerodynamics Departement
ONERA Meudon
(Office National d'Etudes et de Recherches Aérospatiales)
FRANCE
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
|