[Lazarus] how to get Type of Sender or Components[i] in order to Cast?

Péter Gábor ptrg at freemail.hu
Mon Jul 27 07:47:49 CEST 2015


Sorry!
I was "misreading" your mail... you want to know the type of them.

You can compare the type of them:

if Sender = TButton then { do something} ;

or you can get the name of the class

ShowMessage( Sender.classname );


2015-07-27 07:30 keltezéssel, Péter Gábor írta:
> If you typecast something you can use the fields and properties of the
> type you use for casting, for example:
> 
> if TCheckBox(Sender).Checked then {do_something}  ;
> 
> or
> 
> if TCheckBox(Components[I]).Checked then {do_something}  ;
> 
> 
> 2015-07-27 00:31 keltezéssel, Bob B. írta:
>> how to get Type of Sender or Components[i] in order to Cast?
>> Thanks.
>>
>> Bob B.
>>
> 

-- 
Péter Gábor
ptrg at freemail.hu





More information about the Lazarus mailing list