Вниз
Скачать: CL | DM;

Как перебрать все компоненты на форме   Найти похожие ветки 

 
Chcnger   (2004-03-31 13:22) [0]

ЗДРАВСТВУЙТЕ! Как можно на форме перебрать все компоненты(естественно программно) и поменять их Caption(если он есть)?
За ранее спасибо


 
[lamer]Barmaglot ©   (2004-03-31 13:28) [1]

procedure TForm1.Button1Click(Sender: TObject);
var
 k:    integer;
begin
For k:=1 to Form1.ComponentCount-1 do
Listbox1.items.add(Form1.Components[k].Name);
end;

Остальное посмотри сам...


 
Sun bittern ©   (2004-03-31 13:30) [2]

procedure A(AComponent: TComponent);
var
I: Integer;
begin
 for I := 0 to AComponent.ComponentCount - 1 do
 begin
   ...
   ...
   if AComponent.Components[I].ComponentCount > 0 then A(AComponent);
 end;
end;

Caption и возможные последствия
http://delphimaster.net/view/1-1080711559/


 
Sun bittern ©   (2004-03-31 13:33) [3]

if AComponent.Components[I].ComponentCount > 0 then A(AComponent.Components[I]);


 
Юрий Зотов ©   (2004-03-31 13:40) [4]

> [lamer]Barmaglot ©   (31.03.04 13:28) [1]

Скажите, а зачем Вы пишете Form1? Что за странный стиль?

А если никакой Form1 вовсе не существует? А если форма называется Form777? А если таких форм пара десятков?

Тогда как быть?


 
Игорь Шевченко ©   (2004-03-31 13:42) [5]

uses
 TypInfo;

procedure TForm1.ChangeCaptions (const NewCaption:string);
var
 I: Integer;
begin
 for I:=0 to Pred(ComponentCount) do
   if IsPublishedProp(Components[I], "Caption") then
     SetStrProp(Components[I], "Caption", NewCaption);
end;


 
Ega23 ©   (2004-03-31 14:12) [6]

For k:=1 to Form1.ComponentCount-1 do
Listbox1.items.add(Form1.Components[k].Name);

А как быть с Components[0]?



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.02 c
1-1080735684
Balkon
2004-03-31 16:21
2004.04.18
Печать StringGrid в QuickReport


7-1077123849
juiceman
2004-02-18 20:04
2004.04.18
сервис


14-1079932827
Sphinx
2004-03-22 08:20
2004.04.18
Что такое хорошо и что такое плохо


14-1080154088
Knight
2004-03-24 21:48
2004.04.18
Динамические массивы...


1-1080891059
wa-ckum-gg
2004-04-02 11:30
2004.04.18
RichEdit/RxRichEdit верхний/нижний индекс




   Наверх