{ TForm1 } uses TypInfo;procedure TForm1.CrnGetCtrlCaptions(pList: TStrings); var i: Integer; begin for i := 0 to ComponentCount - 1 do begin if IsPublishedProp(Components[i], 'Caption') then pList.Add( GetPropValue(Components[I], 'Name') + ' --> ' + GetPropValue(Components[I], 'Caption')); end; end;procedure TForm1.Button1Click(Sender: TObject); begin CrnGetCtrlCaptions(ListBox1.Items); end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Button1: TButton;
pnl1: TPanel;
Label1: TLabel;
Button2: TButton;
RadioButton1: TRadioButton;
CheckBox1: TCheckBox;
ListBox1: TListBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure CrnGetCtrlCaptions(pList: TStrings);
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
{ TForm1 }
uses TypInfo;procedure TForm1.CrnGetCtrlCaptions(pList: TStrings);
var
i: Integer;
begin
for i := 0 to ComponentCount - 1 do
begin
if IsPublishedProp(Components[i], 'Caption') then
pList.Add(
GetPropValue(Components[I], 'Name')
+ ' --> ' +
GetPropValue(Components[I], 'Caption'));
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
CrnGetCtrlCaptions(ListBox1.Items);
end;end.