0
So as there is this in Javascript, what is the equivalent in Delphi? And how would I use it? I want to replace the 'Unibuttonx' of each procedure with a 'this' equivalent to the button clicked.
procedure TUniForm1.UniButton1Click(Sender: TObject);
var numero : string;
begin
numero := UniEdit1.Text;
UniEdit1.Text := numero + UniButton1.Caption;
end;
procedure TUniForm1.UniButton2Click(Sender: TObject);
var numero : string;
begin
numero := UniEdit1.Text;
UniEdit1.Text := numero + UniButton2.Caption;
end;
The
thisof Delphi is calledself. But in the case in question it refers to the form, since all methods are from Tuniform1. As you saw yourself, the button comes from the Sender parameter.– marcus