Autor Beitrag
Bockscar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 105



BeitragVerfasst: Sa 11.02.06 21:10 
Es gibt 37 Labels und beide sollen bei ONCLICK die gleiche Prozedur aufrufen, aber sich darin unterscheiden:

ausblenden Delphi-Quelltext
1:
2:
3:
if sender = l_table0 then number := 0;
if sender = l_table1 then number := 1;
//etc.


Also je nachdem welches Label der Sender ist, ist auf ne andere Zahl auf dem Spielfeld gedrückt worden.

Bevor ich da jetzt 37 mal das so mache ... gibt es da irgendwie ne andere möglichkeit das umzusetzen?

(CASE OF wollte nicht funktionieren)

gruß


Moderiert von user profile iconGausi: Topic aus Sonstiges (Delphi) verschoben am Sa 11.02.2006 um 21:14
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: Sa 11.02.06 21:13 
Bei sowas kann man gut den Tag des Sender einsetzen. Einfach in den 37 Labels den Tag von 1-37 setzen, und dann mit Case arbeiten.
Aber dein Weg sollte auch gehen.

_________________
We are, we were and will not be.
Bockscar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 105



BeitragVerfasst: Sa 11.02.06 21:15 
also case sender.tag of ... ?
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 28

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Sa 11.02.06 21:16 
user profile iconBockscar hat folgendes geschrieben:
Es gibt 37 Labels und beide sollen bei ONCLICK die gleiche Prozedur aufrufen, aber sich darin unterscheiden:

irgendwie ist das widersprüchlich Oo
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: Sa 11.02.06 21:20 
Ich weiß nicht genau, wie deine komplette Prozedur aussehen soll, evtl. geht ja sogar:
number := Sender.Tag; - Aber ja: Case Sender.Tag of... sollte gehen.

_________________
We are, we were and will not be.
Bockscar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 105



BeitragVerfasst: Sa 11.02.06 21:24 
thx.


PS: das war widersprüchlich weil ich das beispiel erst an 2 labels erläutern wollte und dann doch eher 37 genommen habe ;)
Bockscar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 105



BeitragVerfasst: Sa 11.02.06 21:26 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure Tspielflaeche.label_pleinclick(Sender: TObject);
var bet :integer;
begin
bet := Sender.Tag;
label2.Caption := inttostr(number);
croupier.brettclick('plein',bet);
end;



also das funktioniert jetzt irgendwie nich