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



BeitragVerfasst: Fr 17.02.06 21:10 
Guten Abend.

Ich habe folgende Frage:

Ich kann ja z.b schreiben:

ausblenden Delphi-Quelltext
1:
2:
3:
if sender = label1 then X
if sender = label2 then X
...

und dann

if sender = label 40 then Y

ich könnte ja jetzt 39 ORs dazwischen setzen

ausblenden Delphi-Quelltext
1:
2:
if sender = label1 or label2 or ... then X
 else Y;



kann ich irgendwie SENDER auch unter eine gruppe fassen?
Durch einen gemeinsamen TAG oder sowas?

Und wie muss dann der check aussehen? IF ... then ?


Vielen Dank im VOrraus

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Ironwulf
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: Fr 17.02.06 21:12 
joa mit dem tag würde das gehen
ausblenden Delphi-Quelltext
1:
If Sender(TLabel).Tag = 1 Then X					
Bockscar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 105



BeitragVerfasst: Fr 17.02.06 21:25 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TSpielflaeche.table_click(Sender: TObject);
var bet :integer;
begin
bet := Sender(TLabel).Tag;
If (Sender(TLabel).Tag < 37then croupier.brett_click('plein',bet);
end;



wieso geht das nicht? Da wird immer gesagt OPERATOR oder SEMIKOLON fehlt
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 17.02.06 21:34 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TSpielflaeche.table_click(Sender: TObject);
var bet :integer;
begin
bet := (Sender as TLabel).Tag;
If (bet < 37then croupier.brett_click('plein',bet);
end;

_________________
We are, we were and will not be.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Fr 17.02.06 23:23 
Hallo, oder auch so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
case TLabel(Sender).Tag of
  0..36  : MachDies;
  37     : MachDas;
  38..40 : OderWasAnderes;
end:

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )