Home > Software engineering >  MFC about three synthesis a click event click event, how should do?
MFC about three synthesis a click event click event, how should do?

Time:04-08

,, can you tell me in MFC applications, if there are three click event, such as OnBtn1Clicked (); OnBtn2Clicked (); OnBtn3Clicked (); , now want to use the time of a button, will, these three click events in sequence, namely first perform OnBtn1Clicked (); Events, after processing the btn1, just continue processing OnBtn2Clicked (); Again, after processing the btn2, processing OnBtn3Clicked (); , if there is an error in one of these, that is, and you, how to achieve this, please?

CodePudding user response:

Three events encapsulated into separate functions, int return value to indicate whether error
 
Int Func1 ();
Int Func2 ();
Int Func3 - a non-class function ();

//then OnBtn1Clicked (); OnBtn2Clicked (); OnBtn3Clicked (); Respectively, in turn, calls the above three functions for the

//if you want to synthesis a is similar to:
Void OnBtnTotalClick ()
{
Int iRet=Func1 ();
If (iRet==1)
IRet=Func2 ();//Func1 returns successfully executed Func2, Func3 - a non-class function similar processing
}
  • Related