MinnisotaFreezing
Programmer
I need some help and advice. I don't usually use the default CDialog::OnOk function, mostly because I don't know how to use it very well. So in the class I derived from CDialog, I overode it and didn't call the CDialog version, like so.
virtual void OnOK();
void BillTo::OnOK()
{
DoSomeStuff
.
EndDialog(5);
}
Then, I derived(derove?) a class from BillTo and in the declaration put
void OnOk();
void VendorBillTo::OnOK()
{
SomeStuff
.
EndDialog(5);
}
I then get the error message
error C2509: 'OnOK' : member function not declared in 'VendorBillTo'
To me, it is clearly declared in the class. I have run into this problem in the past, and simply renamed the OnOk function to OnSave, changed the button ID to != IDOK, and MessageMaped it myself, and everything works ok. But I kind of want to know why this isn't working. I don't want to use work arounds all the time.
So my second question is, do you all use CDialog::OnOk, or do you make your own exit function. I rarely use UpdateData, but it would be hand in some cases. Also, Return by default triggers OnOk, that would be nice not to have to hook that for every dlg box. Is it worth the hasle?
virtual void OnOK();
void BillTo::OnOK()
{
DoSomeStuff
.
EndDialog(5);
}
Then, I derived(derove?) a class from BillTo and in the declaration put
void OnOk();
void VendorBillTo::OnOK()
{
SomeStuff
.
EndDialog(5);
}
I then get the error message
error C2509: 'OnOK' : member function not declared in 'VendorBillTo'
To me, it is clearly declared in the class. I have run into this problem in the past, and simply renamed the OnOk function to OnSave, changed the button ID to != IDOK, and MessageMaped it myself, and everything works ok. But I kind of want to know why this isn't working. I don't want to use work arounds all the time.
So my second question is, do you all use CDialog::OnOk, or do you make your own exit function. I rarely use UpdateData, but it would be hand in some cases. Also, Return by default triggers OnOk, that would be nice not to have to hook that for every dlg box. Is it worth the hasle?