home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1999 January
/
Chip_1999-01_cd.bin
/
zkuste
/
delphi
/
D1
/
CALCBOX.ZIP
/
DEMO
/
DRAGDROP.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-12-30
|
3KB
|
124 lines
unit Dragdrop;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, StdCtrls, Cvgcalc, Buttons;
type
TForm3 = class(TForm)
BitBtn1: TBitBtn;
Label1: TLabel;
CalculatorBox1: TCalculatorBox;
CalculatorBox2: TCalculatorBox;
CalculatorBox3: TCalculatorBox;
Edit1: TEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
Shape7: TShape;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
Label7: TLabel;
Shape8: TShape;
Shape9: TShape;
Shape10: TShape;
Image5: TImage;
procedure CalculatorBox2DragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
procedure CalculatorBox3DragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
procedure CalculatorBox2DragDrop(Sender, Source: TObject; X,
Y: Integer);
procedure Edit1DragDrop(Sender, Source: TObject; X, Y: Integer);
procedure CalculatorBox3DragDrop(Sender, Source: TObject; X,
Y: Integer);
procedure Edit1Change(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.DFM}
procedure TForm3.CalculatorBox2DragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
Accept := Source is TCalculatorBox;
end;
procedure TForm3.CalculatorBox3DragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
Accept := Source is TEdit;
end;
procedure TForm3.CalculatorBox2DragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
CalculatorBox2.displaytext:= (Source as TCalculatorBox).Text;
end;
procedure TForm3.Edit1DragDrop(Sender, Source: TObject; X, Y: Integer);
begin
Edit1.text:= (Source as TCalculatorBox).Text;
end;
procedure TForm3.CalculatorBox3DragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
CalculatorBox3.displaytext:= (Source as TEdit).Text;
end;
procedure TForm3.Edit1Change(Sender: TObject);
var
mystring: string;
holdit : string[1];
lnth: integer;
begin
mystring:=edit1.text;
lnth := length(mystring);
if lnth>0 then
begin
holdit := mystring[lnth];
if strToint(holdit) > 9 then
if strToint(holdit) < 0 then
edit1.text:=copy( mystring,1,lnth-1);
end;
end;
procedure TForm3.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if ( (key < '0') OR (key > '9') ) AND ( key <> #8 ) then
begin
MessageBeep(0);
Key := #0;
end;
end;
end.