Autor Beitrag
Hackbert
Hält's aus hier
Beiträge: 7



BeitragVerfasst: So 20.03.05 22:40 
Hi zusammen ich habe folgendes Problem.

Habe ein Programm mit 3 RadioButtons ( Radiobutton 1-3) und ein Label (label1).
Wenn ich nun auf ein radiobutton klicke, soll automatisch das label den namen bekommen, wie der RadioButton...
Meine RadioButtons haben verschiedene Namen....
Hoffe ihr versteht was ich meine.. habe als Anhang das Project geschickt.

habe mir gedacht für procedure OnClick :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.test(Sender: TObject);
var i: integer;
begin
label1.caption:=Radiobutton1.caption;
for i:=1 to 3 do
label1.Caption:=TRadioButton((FindComponent('RadioButton'+intToStr(i))).checked=true).caption;
end;



Aber da ist was falsch.. habe kein SKILL.
Der sagt Undefinierter Bezwichner 'checked'


Wenn ich im falschen Forum gepostet habe, sry... bin neu hier....
Einloggen, um Attachments anzusehen!
Jailbird
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 127

Windows XP Pro SP2
Delphi 7 Professional
BeitragVerfasst: So 20.03.05 22:55 
vergib allen RadioButtons die gleiche Prozedur OnClick. Dann folgender Code:

ausblenden Quelltext
1:
Label1.Caption := TRadioButton(Sender).Name;					
Hackbert Threadstarter
Hält's aus hier
Beiträge: 7



BeitragVerfasst: So 20.03.05 23:46 
thx das klappt, aber lasst mal andere situation durcharbeiten....:

sagen wir mal irgend ein RadioButton hat von schon checked=true...
was denn?

er soll die suchen, die checked ist und das label so umbenennen...
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mo 21.03.05 10:42 
ausblenden Delphi-Quelltext
1:
2:
3:
for i:=1 to 3 do
if TRadioButton(FindComponent('RadioButton'+intToStr(i))).checked=true then
  label1.Caption:= TRadioButton(FindComponent('RadioButton'+intToStr(i))).Caption

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Jailbird
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 127

Windows XP Pro SP2
Delphi 7 Professional
BeitragVerfasst: Mo 21.03.05 11:09 
musst allerdings immer noch die bereits vorhandene caption "dazuzählen"

ausblenden Delphi-Quelltext
1:
label1.caption := label1.caption + zeuchs von StefanH