Thaddy, please stop playing the boss here. A boss insulting his employees is not a good boss anyway.
Well, if even you do not write proper code (using the
sender parameter), what else can I do?
Although I agree with your comment, there is a limit. Someone has to take responsability. Otherwise you are not operating a solid team. This is like raising children, not about who's boss...
Use the
sender and don't blame me. Pretty much how the language is designed.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure AnyButtonClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.AnyButtonClick(Sender: TObject);
begin
if sender is TButton then with TButton(sender) do
Caption := 'I am '+ Tbutton(sender).Name // and you have full control over the instance
else
Showmessage('I am a control but not really relevant, it seems');
end;
end.
Pardon me for not giving the controls meaningful names. You know I would have done so.
If you can write the code in a one-liner and already explained this, then why complain?
Point is that it does not matter how many sliders,or in this case buttons, are there... See?