RE: How to: Use dialogbox to control close event? by charliewest
charliewest
Fri Oct 22 12:53:02 CDT 2004
Vu, this isn't exaclty it. I am trying to capture the result of the dialog
box w/ YES and NO buttons and based on the result, continue closing or not
the form. The OK button on the top right of the smart device forms is the
same as the close box on regular windows forms.
Anyway, i managed to resolve this by using the e.Cancel on the system
argument if the user selected DialogBox.No.
Thanks.
"Vu" wrote:
> "charliewest" wrote:
>
> > I am trying to use a dialogbox with YES / NO buttons to control the events
> > that fire when the user clicks the OK button on the pocket pc ControlBox (The
> > equivalent of a close button on normal windows apps). The purpose being to
> > confirm if the user wants to close the form or not.
> >
> > However, it seems that the only event the OK button fires is the Closing
> > event. What other event shuold i capture or how can this be done w/ Closing?
>
> If I understand correctly, you want to process the Ok button without closing
> the dialog ? If so, add a virtual void OnOK() function.
> in .h file , inside the CYourDialog definition, add a public
> virtual void OnOK();
>
> in .cpp file, add
> void YourCDialog::OnOK()
> {
> if ( conditions that you do not want to close the dialog )
> {
> // do anything but do not call CDialog::OnOK();
> }
> else // condition that you want to close the dialog
> {
> // clean up code
> CDialog::OnOK();
> }
> }
>
> Vu
>