home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Programming Unleashed
/
Delphi_Programming_Unleashed_SAMS_Publishing_1995.iso
/
chap28
/
object4
/
selldlgs.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-03-20
|
2KB
|
80 lines
unit Selldlgs;
{ Program copyright (c) 1995 by Charles Calvert }
{ Project Name: OBJECT4 }
interface
uses
WinTypes, WinProcs, Classes,
Graphics, Forms, Controls,
Buttons, StdCtrls, ExtCtrls,
Mask, SysUtils;
type
TDataRec = record
BlueTotal: LongInt;
YellowTotal: LongInt;
GreenTotal: LongInt;
VioletTotal: LongInt;
end;
TSellDlg = class(TForm)
OKBtn: TBitBtn;
CancelBtn: TBitBtn;
HelpBtn: TBitBtn;
Bevel1: TBevel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
MaskEdit1: TMaskEdit;
MaskEdit2: TMaskEdit;
MaskEdit3: TMaskEdit;
MaskEdit4: TMaskEdit;
procedure FormActivate(Sender: TObject);
public
function GetData(var DataRec: TDataRec): Boolean;
end;
var
SellDlg: TSellDlg;
implementation
uses
StrBox;
{$R *.DFM}
function CheckString(S: string): string;
begin
S := CleanString(S);
if S = '' then S := '0';
Result := S;
end;
function TSellDlg.GetData(var DataRec: TDataRec): Boolean;
var
i: Integer;
begin
GetData := True;
for i := 0 to ComponentCount - 1 do
if Components[i] is TMaskEdit then
TMaskEdit(Components[i]).Text := '';
if ShowModal = mrOk then begin
DataRec.BlueTotal := StrToInt(CheckString(MaskEdit1.Text));
DataRec.YellowTotal := StrToInt(CheckString(MaskEdit2.Text));
DataRec.GreenTotal := StrToInt(CheckString(MaskEdit3.Text));
DataRec.VioletTotal := StrToInt(CheckString(MaskEdit4.Text));
end else
GetData := False;
end;
procedure TSellDlg.FormActivate(Sender: TObject);
begin
MaskEdit1.SetFocus;
end;
end.