Home > Back-end >  C Builder event handler has a parameter is a reference type, I want to manually call the function, h
C Builder event handler has a parameter is a reference type, I want to manually call the function, h

Time:12-05

The event handler is a parameter is a reference type, I want to manually call the function, how to pass parameters?
//click the control button
Void __fastcall TForm1: : MediaPlayer1Click (TObject * Sender, TMPBtnType Button, bool & amp; DoDefault)

{
DoDefault=true;//do button default action
If (Button==TMPBtnType: : btPlay)//if it is a play Button
This - & gt; Timer1 - & gt; Enabled=true;
}
I call like this:
Bool DoDefault;
MediaPlayer1Click (Sender, TMPBtnType: : btPlay, DoDefault);//compile error
//MediaPlayer1Click (Sender, TMPBtnType: : btPlay, true);//compile error
How should the parameters?
This reference some internal variable parameters cited the upper function, need to set the value, if can manually call this function will make the internal variables cannot get the value?
Because when playing a extra timer operation, I want to call this function by hand at the beginning, compiled through, so we have to Play every time after the add operation statement of the timer,
But this function call why not?
  • Related