Autor Beitrag
Dragonclaw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Do 30.08.07 19:24 
Hallo, ich bin gerade dabei Minesweeper zuschreiben. Die Felder habe ich mit SpeedButtons gemacht. So jetzt will ich aber auch die Größe des Spielfeldes verändern können. Allerdings sollen nur nötige Buttons gelöscht oder erstellt werden.


Wie finde ich heraus ob eine Komponente exsistier? Gibt es dafür eine Funktion à la
ausblenden Delphi-Quelltext
1:
if Komponent('b1tn9'then ShowMessage('b1tn9 exsistier')					



Vielen Dank für die Hilfe.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 30.08.07 19:27 
Guck dir mal FindComponent in der Hilfe an.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Dragonclaw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Do 30.08.07 19:36 
Mit FindComponent hab ich schon herumgespielt.


Die erste Idee die ich hatte war dies
ausblenden Delphi-Quelltext
1:
FindComponent('b'+ IntToSTr(X) +'tn'+ IntToStr(Y)) = TComponent('b'+ IntToSTr(X) +'tn'+ IntToStr(Y))					


das hat nicht geklappt, dann hatte ich folgende Idee
ausblenden Delphi-Quelltext
1:
TSpeedButton(FindComponent('b'+ IntToSTr(X) +'tn'+ IntToStr(Y))).Name = 'b'+ IntToSTr(X) +'tn'+ IntToStr(Y)					


Das ganze in nen Try - except Block gesetzt, allerdings klappt das auch nicht.

Hat sonst noch jemand ne Idee.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 30.08.07 19:44 
Wie wäre es damit?:

ausblenden Delphi-Quelltext
1:
2:
  if FindComponent('b'+ IntToSTr(X) +'tn'+ IntToStr(Y)) = nil then
    ShowMessage('Compo nicht vorhanden!');

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Dragonclaw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Do 30.08.07 19:54 
ahhh okay, vielen Dank