@Tino: Ja, da hast du wohl recht, umständlich ist mein Ansatz allemal, nur das mit dem Comboboxen editieren wenn eine bestimmte Zahl eingegeben wurde, das hab ich probiert und dann wieder sein lassen, da ich(wir) etwas unter Zeitdruck stehen und mir das zu kompliziert war.
Ich hab es jetzt mit 4 Comboboxen geschafft, ist aber ne Menge Quelltext geworden
@Andi1982: Ne, die Zw1 brauch ich später nicht, aber wie soll ich sonst an Zw2 rankommen, man hat mir beigebracht, dass (in meinem Fall) Zw2 der Rest ist, der bei J div 4 übrigbleibt und irgendwohin muss ich doch das Ergebnis von J div 4 speichern, oder hab ich da jetzt nen Denkfehler gemacht? oO
Naja, hier meine etwas unelegante Lösung des Combobox Problems.
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: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166:
| procedure TFormEinlagern.DatumCombo;
var Zw1,Zw2,J,I : integer; begin
J := StrToInt(EditJahr.Text); I := StrToInt(ComboBoxMonat.Text); Zw1 := J div 4; Zw2 := J mod 4; if Zw2 = 0 then if I = 2 then ComboBoxTag29.Visible := true; ComboBoxTag28.Visible := false; ComboBoxTag30.Visible := false; ComboBoxTag31.Visible := false;
if Zw2 = 0 then case StrToInt(ComboboxMonat.Text) of 1 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 3 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 5 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 7 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 8 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 10 :begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 12 :begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 4 : begin ComboBoxTag30.Visible := true; ComboBoxTag31.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 6 : begin ComboBoxTag30.Visible := true; ComboBoxTag31.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 9 : begin ComboBoxTag30.Visible := true; ComboBoxTag31.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 11 :begin ComboBoxTag30.Visible := true; ComboBoxTag31.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; end;
if Zw2 <> 0 then case StrToInt(ComboboxMonat.Text) of 1 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 3 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 5 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 7 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 8 : begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 10 :begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 12 :begin ComboBoxTag31.Visible := true; ComboBoxTag30.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 4 : begin ComboBoxTag30.Visible := true; ComboBoxTag31.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 6 : begin ComboBoxTag30.Visible := true; ComboBoxTag31.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 9 : begin ComboBoxTag30.Visible := true; ComboBoxTag31.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 11 :begin ComboBoxTag30.Visible := true; ComboBoxTag31.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag28.Visible := false; end; 2 : begin ComboBoxTag28.Visible := true; ComboBoxTag31.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag30.Visible := false; end;
end; end; |
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:
| procedure TFormEinlagern.ComboBoxMonatChange(Sender: TObject); begin DatumCombo; end;
procedure TFormEinlagern.Datum; begin Datumcombo;
if ComboBoxTag31.Visible = true then LabelDatum.Caption := (ComboboxTag31.Text + '.' + ComboBoxMonat.Text + '.' + EditJahr.Text); if ComboBoxTag30.Visible = true then LabelDatum.Caption := (ComboboxTag30.Text + '.' + ComboBoxMonat.Text + '.' + EditJahr.Text); if ComboBoxTag29.Visible = true then LabelDatum.Caption := (ComboboxTag29.Text + '.' + ComboBoxMonat.Text + '.' + EditJahr.Text); if ComboBoxTag28.Visible = true then LabelDatum.Caption := (ComboboxTag28.Text + '.' + ComboBoxMonat.Text + '.' + EditJahr.Text);
begin if ComboBoxTag28.Text = '' then if ComboBoxTag28.visible = true then begin ShowMessage('Sie müssen einen Tag wählen!'); exit; end; end; begin if ComboBoxTag29.Text = '' then if ComboBoxTag29.visible = true then begin ShowMessage('Sie müssen einen Tag wählen!'); exit; end; end; begin if ComboBoxTag30.Text = '' then if ComboBoxTag30.visible = true then begin ShowMessage('Sie müssen einen Tag wählen!'); exit; end; end; begin if ComboBoxTag31.Text = '' then if ComboBoxTag31.visible = true then begin ShowMessage('Sie müssen einen Tag wählen!'); exit; end; end; begin if ComboBoxMonat.Text = '' then begin ShowMessage('Sie müssen einen Monat wählen!'); exit; end; if EditJahr.Text = '' then begin ShowMessage('Sie müssen ein Jahr eingeben!'); exit; end;
end; end; |
Und zu guter letzt, damit man nicht mit den Daten durcheinander kommt, was mir des öfteren passiert ist
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
| procedure TFormEinlagern.ButtonUebernehmenClick(Sender: TObject);
begin Datum; EditJahr.Text := ''; ComboboxMonat.Text := ''; ComboBoxTag28.Visible := false; ComboBoxTag29.Visible := false; ComboBoxTag30.Visible := false; ComboBoxTag31.Visible := false;
end; |