Registriert seit: 27. Feb 2008
Ort: Lübeck
29 Beiträge
Delphi 6 Enterprise
|
Re: Problem: DBEdit/Edit Felder per Knopfdruck generieren
11. Mär 2008, 18:10
Delphi-Quellcode:
function Create_Fields(Mode, DLeft, DTop, DWidth, DHeight: Integer; DText: String): TDBEdit;
var DBE: TDBEdit;
var DLabel: TLabel;
var DMemo: TMemo;
var DEdit: TEdit;
var i, x, y, LabelNum, DLeft_Counter: Integer;
begin
LabelNum := 1;
DLeft_Counter := 0;
for x := 1 to (Length(LabelArray) + 1) do begin
if LabelArray[x] = 'Artikel' then begin
DMemo := TMemo.Create(Form1);
with DMemo do begin
Name := 'Memo_' + IntToStr(Save_NumFields);
Parent := Form1.ScrollBox1;
Left := Left + DLeft + DLeft_Counter;
if x <= Length(LabelArray) then Top := Top + DTop + 16;
Width := DWidth;
Height := DHeight + 20;
ScrollBars := ssVertical;
Text := '';
end;
end else begin
if x <= Length(LabelArray) then begin
DEdit := TEdit.Create(Form1);
with DEdit do begin
Name := 'Edit_' + IntToStr(Save_NumFields);
Parent := Form1.ScrollBox1;
Left := Left + DLeft + DLeft_Counter;
if x <= Length(LabelArray) then Top := DTop + 32
else Top := DTop + 16;
if (LabelArray[x] = 'EP') OR (LabelArray[x] = 'GP') then begin
Width := DWidth - 80;
Text := '0,00'
end
else begin
Width := DWidth;
Text := '';
end;
Height := DHeight;
if LabelArray[x] = 'GP' then Enabled := false;
end;
DBE := TDBEdit.Create(Form1);
with DBE do begin
Name := 'DBEdit_' + IntToStr(Save_NumFields);
Parent := Form1.ScrollBox1;
Left := Left + DLeft + DLeft_Counter;
if x <= Length(LabelArray) then Top := DTop + 32
else Top := DTop + 16;
if (LabelArray[x] = 'EP') OR (LabelArray[x] = 'GP') then Width := DWidth - 80
else Width := DWidth;
Height := DHeight;
Text := DText;
Visible := false;
end;
end;
DLabel := TLabel.Create(Form1);
with DLabel do begin
Name := 'Label_' + IntToStr(Save_NumFields);
Parent := Form1.ScrollBox1;
Left := Left + DLeft + DLeft_Counter;
if x <= Length(LabelArray) then begin
if LabelArray[x] = 'Artikel' then Top := DTop - 56
else TLabel(DLabel).Top := DTop + 16;
end else Top := DTop - 16;
Caption := LabelArray[x];
end;
end;
LabelNum := LabelNum + 1;
if Mode = 0 then Save_NumFields := Save_NumFields + 1
else Save_NumFields := Save_NumFields - 1;
DLeft_Counter := DLeft_Counter + 136;
end;
DLabel.Left := DLeft;
DTop := DTop + 48;
end;
|
|
Zitat
|