The problem here is how to distinguish between a press/hold/release sequence and a click. The next tricky issue is the requirement to hold down the mouse to play and release it to pause. One trivial issue with this code is that the TMediaPlayer already keeps track of what it is doing so you could check MP1.Mode and eliminate the isPlaying variable. I should have seen that but I focused too much on Michaël's syntax errors rather than his logic. Simon, that is a nice and simple approach, better in many ways than changing the event handler. Procedure TForm1.FormClick(Sender: TObject) Procedure TForm1.PausePlay(Sender: TObject) Ok so, it keeps giving the same error at the procedure TMediaPlayer.Play The line Form2.Click := MP1.Pause has the same errors. You then assign your StartPlay method as the event handler for the form's onClick event, like this: `Form1.onClick := StartPlay` Procedure TForm1.StartPlay(Sender: TObject) Then in the implementation section implement this as: What you need to do is define your own method whichĭoes match the definition and call MP1.Play from there. The line Form1.Click := MP1.Play has 2 errors:Ī) It should be Form1.onClick because you want to specify the event handler, not actually click the form.ī) Form1.onClick is a TNotify event which is defined as: procedure(Sender: TObject) of object Ī procedure that matches this definition would look like: procedure TSomeObject.SomeMethod(Sender : TObject) Īs you can see it has no Sender parameter so doesn't
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |