Differences between cdialog: onok () and cdialog: oncancel ()

Source: Internet
Author: User

Differences between cdialog: onok () and cdialog: oncancel ()

If data exchange exists in the program, onok can be automatically updated and verified. Oncancel does not perform this operation.

Msdn explanation:
Cdialog: onok
Called when the user clicks the OK button (the button with an ID of idok ).
Virtual void onok ();

Remarks
Override this member function to perform the OK button action. if the dialog box between des automatic data validation and exchange, the default implementation of this member function validates the dialog-box data and updates the appropriate variables in your application.

If you implement the OK button in a modeless dialog box, you must override the onok member function and call destroywindow from within it. don't call the base-class member function, because it callenddialog, which makes the dialog box invisible but does not destroy it.

Cdialog: oncancel
The framework callthis member function when the user clicks the cancel button or presses the ESC key in a modal or modeless dialog box.

Virtual void oncancel ();
 

Remarks
Override this member function to perform cancel button action. The default simply terminates a modal dialog box by calling enddialog and causing domodal to return idcancel.

If you implement the cancel button in a modeless dialog box, you must override the oncancel member function and call destroywindow from within it. don't call the base-class member function, because it callenddialog, which will make the dialog box invisible but not destroy it.

 

 

 

Source code:

Void cdialog: onok ()
{
If (! Updatedata (true ))
{
Trace (traceappmsg, 0, "updatedata failed during dialog termination./N ");
// The updatedata routine will set focus to correct item
Return;
}
Enddialog (idok );
}

Void cdialog: oncancel ()
{
Enddicel (idcancel );
}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.