Autor Beitrag
spongeBHV
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 13.02.07 20:48 
hallo, ich möchte gern editfelder nach ihrem namen ansteuern und sie dadurch sichtbar machen. so in etwa:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
...
for k := 1 to spalten do
for l := 11 to zeilen do
     'edit_'+inttostr (k)'_'+inttostr (l)'_s'.visible := true;

...


edit felder heißen bei mir z.B. "Edit_1_9_S" und "Edit_1_9_a"

kann jemand sagen, ob wie meine idee richtig realisiert wird?

liebe grüeß
stefan
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 13.02.07 20:52 
Die Lösung schimpft sich FindComponent.
Das wurde gerade erst hier gezeigt.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
spongeBHV Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 13.02.07 20:57 
habe es jetzt so gamcht, aber das funzt net! :nixweiss: :gruebel: :nut:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
for k := 1 to spalten do
for l := 11 to zeilen do
     FindComponent('edit_'+inttostr (k)'_'+inttostr (l)'_s').visible := true;

end;


was ist falsch? oder geht es einfacher?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 13.02.07 20:58 
Es fehlt der Typecast zu TEdit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
for k := 1 to spalten do
for l := 11 to zeilen do
     TEdit(FindComponent('edit_'+inttostr (k)'_'+inttostr (l)'_s')).visible := true;

end;

_________________
We are, we were and will not be.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 13.02.07 21:00 
Ach ja, das war der nächste Entwurf, den ich noch speichern muss. Irgendwas mit "Die aussagekräftigste Fehlerbeschreibung (tm) 'Funzt nicht!'" :roll:
Spontan sag ich: Tippfehler!
ausblenden Delphi-Quelltext
1:
FindComponent('edit_'+inttostr(k)+'_'+inttostr(l)+'_s').visible := true;					

Aber nächstes mal sag uns doch bitte, wo der Fehler lag, ob der Compiler eine Meldung ausgegeben hat bzw. welche Meldung das war (Sie lässt sich per STRG+C aus dem Delphi-Fenster herauskopieren)

edit: Ahja, der typecast... Delphi weiß noch nicht, um welche Komponente es sich handelt, da FindComponent mit jeder anderen Komponente genausogut funktioniert. Das teilst du Delphi über den sog. Typecast mit: TEdit( xx ).Visible := true;

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
spongeBHV Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 13.02.07 21:03 
danke schonmal für diesen hinweis. abe rer sagt "[Fehler] Operator oder Semikolon fehlt" und zwar vor "+inttostr (l)'_s')).visible := true;" :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
for k := 1 to spalten do
for l := 11 to zeilen do
     TEdit(FindComponent('edit_'+inttostr (k)'_'+inttostr (l)'_s')).visible := true;

end;
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Di 13.02.07 21:07 
Da fehlt auch ja auch ein '+'. Du kannst Strings nur mit einem PLUS verbinden. ;)
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 13.02.07 21:07 
user profile iconJayEff hat folgendes geschrieben:
Spontan sag ich: Tippfehler!
ausblenden Delphi-Quelltext
1:
FindComponent('edit_'+inttostr(k)+'_'+inttostr(l)+'_s').visible := true;					

:mahn:

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
spongeBHV Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 13.02.07 21:10 
ja, danke. hat geklappt