Autor Beitrag
majolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Mo 28.10.02 18:54 
Hi habe ein kleines Problem mit meinem Code. Der ist zwar nicht besonders schön, mir fiel aber nichts besseres ein.Hier ist er:
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
procedure TFRM_Konjugationen.Konjugiere;
var
i1,i2:integer;
Z1,Z2,ps1,ps2,ps3,pp1,pp2,pp3,s2,kurz:string;
begin

  Z1:='';
  Z2:='';
  i1:=0;
  i2:=0;
  i1:=ComboBox1.ItemIndex ;
  i2:=ComboBox2.ItemIndex ;
  if i1= -1 then
  begin
    Fehlerroutine;
  end else

 Edit17.Text:= s1;
{----------------------Auslesen der endungen-------------------}
   try
    endu:= TIniFile.Create(GetEndu);
    PS1:=endu.ReadString (IntToStr(Geti2),'1S','1');
    PS2:=endu.ReadString (IntToStr(Geti2),'2S','1');
    PS3:=endu.ReadString (IntToStr(geti2),'3S','1');
    PP1:=endu.ReadString (IntToStr(geti2),'1P','1');
    PP2:=endu.ReadString (IntToStr(Geti2),'2P','1');
    PP3:=endu.ReadString (IntToStr(Geti2),'3P','1');
   finally
   endu.Free;
  end;
{-----------Konjugationsfelder---------}

  If ((i1=2) or (i1=3) or(i1=4)) and (i2=1) then
   begin
    Z1:='e';
   end;


  If ((i1=3) or(i1=4)) and ((i2=0)or(i2=6)) then
   begin
    Z2:='u';
   end;

   If (i1=4) and (i2=6) then
    begin
      Edit1.Text:= s1 + ps1 ;
      Edit2.Text:= s1 + 'e' + ps2; //Variation 2Ps Sg kurzvok-i-Konj Ind Pass Präs;
      Edit3.Text:= s1 + Z1 + ps3;
      Edit4.Text:= s1 + Z1 + pp1;
      Edit5.Text:= s1 + Z1 + pp2;
      Edit6.Text:= s1 + Z1 + pp3;
    end else

   If ((i1=0) and (i2=1301)) then
    begin
      Edit1.Text:= Copy(s1,1,Length(s1) - 1 ) +   ps1 ;
      Edit2.Text:= Copy(s1,1,Length(s1) - 1 ) +   ps2;
      Edit3.Text:= Copy(s1,1,Length(s1) - 1 ) +   ps3;
      Edit4.Text:= Copy(s1,1,Length(s1) - 1 ) +   pp1;
      Edit5.Text:= Copy(s1,1,Length(s1) - 1 ) +   pp2;
      Edit6.Text:= Copy(s1,1,Length(s1) - 1 ) +   pp3;
    end else
  If (i1=4) and (i2=14) then
    begin
      Edit1.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + ps1 ;
      Edit2.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + ps2;
      Edit3.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + ps3;
      Edit4.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + pp1;
      Edit5.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + pp2;
      Edit6.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + pp3;
    end else
  If (i1=4) and (i2=18) then
    begin
      Edit1.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + ps1 ;
      Edit2.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + ps2;
      Edit3.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + ps3;
      Edit4.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + pp1;
      Edit5.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + pp2;
      Edit6.Text:= Copy(s1,1,Length(s1) - 1  ) + 'e' + pp3;
    end else
  If (i1=0) and ((i2=0)or(i2=6)) then
    begin
      Edit1.Text:= Copy(s1,1,Length(s1) - 1  ) + ps1 ;//Variation 1Ps Sg aKonj Ind Akt Präs;
      Edit2.Text:= s1 + Z1 + ps2;
      Edit3.Text:= s1 + Z1 + ps3;
      Edit4.Text:= s1 + Z1 + pp1;
      Edit5.Text:= s1 + Z1 + pp2;
      Edit6.Text:= s1 + Z1 + pp3;
    end else
    begin
      Edit1.Text:= s1 + Z1 + ps1;
      Edit2.Text:= s1 + Z1 + ps2;
      Edit3.Text:= s1 + Z1 + ps3;
      Edit4.Text:= s1 + Z1 + pp1;
      Edit5.Text:= s1 + Z1 + pp2;
      Edit6.Text:= s1 + Z1 + Z2 + pp3;
    end;


  If Checkbox2.Checked= true then
begin
  Imperative;
end;
end;

Also es ist so,dass ein Teil des Codes nicht ausgeführt wird.s1 ist ein Wort.Von diesem sollen in best Fällen Buchstaben abgeschnitten werden.Das funzt aber nur beim letzten:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
 If (i1=0) and ((i2=0)or(i2=6)) then
    begin
      Edit1.Text:= Copy(s1,1,Length(s1) - 1  ) + ps1 ;//Variation 1Ps Sg aKonj Ind Akt Präs;
      Edit2.Text:= s1 + Z1 + ps2;
      Edit3.Text:= s1 + Z1 + ps3;
      Edit4.Text:= s1 + Z1 + pp1;
      Edit5.Text:= s1 + Z1 + pp2;
      Edit6.Text:= s1 + Z1 + pp3;
    end else
    begin
      Edit1.Text:= s1 + Z1 + ps1;
      Edit2.Text:= s1 + Z1 + ps2;
      Edit3.Text:= s1 + Z1 + ps3;
      Edit4.Text:= s1 + Z1 + pp1;
      Edit5.Text:= s1 + Z1 + pp2;
      Edit6.Text:= s1 + Z1 + Z2 + pp3;
    end;


Auch wenn die anderen die Ifvorraussetzungen erfüllen,werden die Buchstaben nicht abgeschnitten.Nur beim letzten.
Kann mir das nicht erklären. habe wahrscheinlich einen Fehler gemacht,der mir nach mehreren Stunden nicht mehr auffällt.Kann mir einer helfen?
Danke im vorraus.
Gruß
majolo
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Di 29.10.02 16:23 
wo setzt du denn s1?

i1:=ComboBox1.ItemIndex ;
i2:=ComboBox2.ItemIndex ;

kann es an diesen beiden zuweisungen liegen, daß du nur die letzte anweigund ausführst???

Gruß
Ken
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Di 29.10.02 17:58 
Also s1 ist eine Funktion.Die liefert mir den Wert für s1.An i1 und i2 kann es nicht liegen.Die Bedingungen werden erfüllt nur der letzte Code funktioniert bei den von mir vereinbarten Bedingungen.
majolo
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Di 29.10.02 21:38 
Habe Fehler gefunden.Ist unrelevant um hier aufzulistem.
@Admins: Ihr könnt den Thread löschen.Ist nicht mehr von Bedeutung.
Gruss
majolo