NH> void CComUI::OnCancel()
NH> {
NH> CWnd * pbutton = GetDlgItem(IDCANCEL);
NH> pbutton->EnableWindow(FALSE);
NH> .
NH> .
NH> .
NH> CDialog::OnCancel();
NH> }
NH> Does the line containing the call to the parent "percolate" up to th
Never heard the word "percolate". "CDialog::OnCancel();" calls the
OnCancel method as implemented in or inherited by class CDialog. It is
very common for overriding virtual methods to call the overriden
method of the base class.
NH> child? What is the purpose of this call in the first place if
If the method CComUI::OnCancel() is meant to add behavior to the
standard behavior of the dialog when the Cancel button is pressed, the
most common way to do it is to first do your stuff and then invoke the
inherited behavior, exactly as in the code snippet above.
NH> CDialog::OnCancel() had never been specifically fleshed out (or even
NH> mentioned) anywhere in the code?
If there weren't an implementation of CDialog:OnCancel(), you'd get a
linker error.
NH> As an aside, I commented this line out and the software ran as
NH> expected. With that line left in the code there was always a premat
NH> closing of the dialog box. Does this mean that the method,
NH> CDialog::OnCancel(), was performing some action on its own without m
NH> even being aware of it?
Yes. The standard behavior of a dialog when the Cancel button is
pressed is to close itself. That's what happens when you invoke this
standard behavior with "CDialog::OnCancel();".
If you don't want the dialog to close when Cancel is pressed, don't
call "CDialog::OnCancel();". But since the Cancel button's purpose
generally is to close the dialog, you had better look for another
solution to your task.
Thomas
---
þ MM 1.0 #0113 þ Worship my merciful god, or I'll kill you.
---------------
* Origin: McMeier & Son BBS (2:301/138)
|