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:
| var Form1: TForm1; type Bauteil = record Name :string[20]; Hersteller :string[20]; Gruppe :string[10]; Fkt :string[250]; Anzahl :integer; Datenblatt :string[75]; ende :string[5]; end;
var Daten : Array of Bauteil ; data : file of Bauteil ; max : integer = 0 ; Pfad : string = '';
implementation
procedure ExDAT; var i:integer; begin with Form1 do begin if (SaveDialog1.Execute()) then begin assignfile(data,SaveDialog1.FileName); rewrite(data); for i:=1 to max do begin Write(data,Daten[i]); end; closefile(data); end; end; end;
procedure ImDAT; begin with Form1 do begin if OpenDialog1.Execute then begin assignfile(data,OpenDialog1.FileName); reset(data); max:=0; while not eof(data) do begin SetLength(Daten,max+1); Read(data,Daten[max]); if (Daten[max].Ende = 'Ende') then begin max:=max+1; end; end; closefile(data); end; Caption := IntToStr(Max); end; end;
procedure Neu(); var i: integer; begin i := 0;
with Form1 do begin if (Hersteller_Edit.text <> '') and (Name_Edit.Text <> '') and (Gruppe_Combo.ItemIndex <> 0) then begin Max := Max+1; SetLength(Daten, max+1); with Daten[max] do begin Name := Name_Edit.Text; Hersteller := Hersteller_Edit.Text; Gruppe := Gruppe_Combo.Items[Gruppe_Combo.ItemIndex]; if (Funktion_Memo.Lines[0] <> '') then begin while (funktion_Memo.Lines[i] <> '') do begin Fkt := Fkt + Funktion_Memo.Lines[i]; i := i+1; end; end else begin fkt := 'Keine Beschreibung verfügbar'; end; if (Anzahl_Edit.Text <> '') then Anzahl := StrToInt(anzahl_Edit.Text); if (Pfad <> '') then Datenblatt := Pfad; Ende := 'Ende'; end; end; end;
end;
procedure Anzeigen(); var i:integer; begin with Form1.Stringgrid1 do begin RowCount := max+1; for i:=0 to max-1 do begin Cells[0,i+1] := IntToStr(i); Cells[1,i+1] := Daten[i].Name; Cells[2,i+1] := Daten[i].Hersteller; Cells[3,i+1] := Daten[i].Gruppe; Cells[4,i+1] := Daten[i].Fkt; Cells[5,i+1] := IntToStr(Daten[i].Anzahl); Cells[6,i+1] := Daten[i].Datenblatt; end; end; end; |