Autor Beitrag
noctua
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 170



BeitragVerfasst: Sa 30.09.06 15:31 
Hallo

Ich habe da ein kleines Problem, Auf meiner Form liegen einige TLabels in einem 2er Paar. das Linke TLabel des Paars heißt immer "Label1" oder "Label2" (Label mit einer zahl). Das rechte TLabel heißt immer "WLabel1" oder "WLabel2" (immer noch ein W vor den Namen).

Nun möchte ich, dass wenn man z.B. auf "Label1" klickt der Inhalt (caption) von "WLabel1" verändert wird.
Dazu hatte ich diese Idee:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure SkillEintragen(Sender: TLabel);
  var WertName: TComponentName;
begin
 Form1.Memo2.Lines.Add( Copy(Sender.Name, 0, Length(Sender.Name)) );

 WertName := Copy(Sender.Name, 0, Length(Sender.Name));
 WertName := 'W' + Copy(SkillName.Name, 0, Length(SkillName.Name));
 WertName.Caption := 'asd';
end;

procedure TForm1.GesundheitClick(Sender: TObject);
begin
  SkillEintragen( TLabel(Sender) );
end;


Doch um das zu realisieren muss ich es schaffen das 'W' in eine "TComponentName" umzuwandeln und das ganze dann in ein "TLabel" um dann die Caption zu ändern.

vielleicht gibt es ja sowas, doch ich habe nichts gefunden. Oder kibt es da eine andere Möglichkeit?

danke

_________________
Am ende sterben eh alle ................
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Sa 30.09.06 15:36 
Das geht mit Suche in der Entwickler-Ecke FINDCOMPONENT

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
noctua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 170



BeitragVerfasst: Sa 30.09.06 16:03 
mach ich etwas falsch? er sagt immer "undefinierter Bezeichner: 'FindComponent'"

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure SkillEintragen(Sender: TLabel);
  var X : TLabel;
begin

 X := TLabel(FindComponent('bla'));

end;

_________________
Am ende sterben eh alle ................
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Sa 30.09.06 17:53 
FindComponent ist eine Methode eines Controls, also einer Form z.B.

_________________
Na denn, dann. Bis dann, denn.
noctua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 170



BeitragVerfasst: Sa 30.09.06 18:06 
hok, doof von mir.

Danke, du hast mir echt sehr geholfen =D danke

_________________
Am ende sterben eh alle ................