unit frmItemDlg;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, JvExStdCtrls, JvEdit, Buttons, Mask,
JvExMask, JvBaseEdits, JvValidateEdit, JvDatePickerEdit,
JvCheckedMaskEdit, JvMaskEdit, JvToolEdit, WasteItem;
type
TItemDlg =
class(TForm)
Panel1: TPanel;
Bevel1: TBevel;
Label1: TLabel;
Label2: TLabel;
Image1: TImage;
GroupBox1: TGroupBox;
Label5: TLabel;
edTrans: TJvValidateEdit;
edDisp: TJvValidateEdit;
edOverall: TJvValidateEdit;
Label6: TLabel;
Label8: TLabel;
Bevel2: TBevel;
btnCancel: TButton;
btnOK: TButton;
GroupBox2: TGroupBox;
Label3: TLabel;
ItemList: TComboBox;
DatePicker: TJvDatePickerEdit;
Label7: TLabel;
edWeight: TJvValidateEdit;
Label4: TLabel;
procedure btnCancelClick(Sender: TObject);
procedure edOverallEnter(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ItemListKeyUp(Sender: TObject;
var Key: Word;
Shift: TShiftState);
procedure btnOKClick(Sender: TObject);
private
{ Private-Deklarationen }
fPath:
String;
fItems: TStringList;
// protected
fWasteItem: TWasteItem;
public
{ Public-Deklarationen }
property Waste: TWasteItem
read fWasteItem
write fWasteItem;
end;
var
ItemDlg: TItemDlg;
implementation
{$R *.dfm}
procedure TItemDlg.btnCancelClick(Sender: TObject);
begin
ModalResult := mrCancel;
end;
procedure TItemDlg.FormCreate(Sender: TObject);
begin
fPath := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName));
fItems := TStringList.Create;
fWasteItem := TWasteItem.Create(Self);
If FileExists(fPath + '
waste.itm')
then
begin
ItemList.Items.LoadFromFile(fPath + '
waste.itm');
end;
end;
procedure TItemDlg.FormDestroy(Sender: TObject);
begin
ItemList.Items.SaveToFile(fPath + '
waste.itm');
fWasteItem.Free;
fItems.Free;
end;
procedure TItemDlg.btnOKClick(Sender: TObject);
begin
fWasteItem.WasteType := ItemList.SelText;
fWasteItem.Weight := edWeight.Value;
fWasteItem.TransportCost := edTrans.Value;
fWasteItem.DisposalCost := edDisp.Value;
fWasteItem.Date := DatePicker.Date;
ModalResult := mrOK;
end;
end.