01 sender & Tobject part1

preview_player
Показать описание
donate:
Рекомендации по теме
Комментарии
Автор

Actually ... to be 100% correct. The statment that every event has a Sender is incorrect. I can make my own events which have absolutely no sender parameter. Great example is events on a DataSet, they don't have a Sender paramter but a DataSet parameter instead. It actually all depends on the type of event handler.

Additionally I think this might be even better :

if ( Senter is TButton ) then
begin
form1.Caption := TButton( Sender ).Caption;
end;

I can't remember who pointed me to that, but it was someone I met at a delphi event ages ago. Not 100% i remember the explanation fully but the ( Sender as TButton) implicitely checks if the Sender is a TButton descendant. Sicne you have already done that with the If statement the additional check isn't necessary so the TButton( Sender ) version is supposed to be slightly faster.

StefaanLesage
Автор

good work, are you continue with free pascal or not? I want learning desktop with pascal, thank you.

elarapy