I am looking for a way to use one procedure for several buttons. This is for a quiz, how you should press button 1 for question 1, but copying and pasting all the code into 36 buttons and changing the variables to 36 buttons is not very funny for anyone.
So, I thought it was possible:
procedure TForm1.Button[x]Click(Sender: TObject); begin DoTask[x]; end;
X is a variable.
Is something like this possible or are there other ways to get the same result?
source share