I have a form with a lot of TLabels on it. The label will display a '1' or '0' for a data stream. When the label is clicked, it will change logic levels.
procedure TForm2.L_R0D4DblClick(Sender: TObjectl);
If form2.L_R0D4D.Caption = '0' then form2.L_R0D4.caption := '1'
else form2.L_R0D4.caption := '0' ;
Is there an easy way to assign the same Click event to all of the TLabels on the form?
The event would have to change a different TLabel caption. I'm trying to get away from having a 100+ onclick procedures and replace it with 1.
I was thinking something like this:
procedure ToggleBitLabel (Sender :TLabel) ;
If Sender.Caption = '0' then Sender.caption := '1'
else Sender.caption := '0' ;
This one does not work because it can not be declared in the "Type" heading and needs to be decared in the "var" heading.