home *** CD-ROM | disk | FTP | other *** search
- unit Form;
- {
- Task: Change & Animate Mouse Cursors
- Author: Doug Colman (doug@neumann.une.edu.au)
- Date: January 12th 1996
- Version: 1.0
- Compiler: Borland Delphi 1.0
- Input: User Clicks
- Output: Cute Mouse Cursors
- }
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls;
-
- type
- TForm1 = class(TForm)
- Button1: TButton;
- Label1: TLabel;
- Button2: TButton;
- Button3: TButton;
- Button4: TButton;
- Button5: TButton;
- Button6: TButton;
- procedure FormCreate(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button4Click(Sender: TObject);
- procedure Button5Click(Sender: TObject);
- procedure Button6Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
- {Bind cursors to EXE:}
- {$R handzpd.res}
- {$R hourgzpd.res}
-
- {Cursors are loaded into RES file via Image Editor OR Resource Workshop}
-
- const hg1=1; const hg2=2; const hg3=3; const hg4=4; const hg5=5;
- const hg6=6; const hg7=7; const hg8=8; const hg9=9; const hg10=10;
- const fist = 11; {arbitrary number}
- const grab = 12;
- const poin = 13;
- const pull = 14;
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- {spinning hourglass:}
- screen.cursors[1] := LoadCursor(hInstance, pChar('CURSOR_1'));
- screen.cursors[2] := LoadCursor(hInstance, pChar('CURSOR_2'));
- screen.cursors[3] := LoadCursor(hInstance, pChar('CURSOR_3'));
- screen.cursors[4] := LoadCursor(hInstance, pChar('CURSOR_4'));
- screen.cursors[5] := LoadCursor(hInstance, pChar('CURSOR_5'));
- screen.cursors[6] := LoadCursor(hInstance, pChar('CURSOR_6'));
- screen.cursors[7] := LoadCursor(hInstance, pChar('CURSOR_7'));
- screen.cursors[8] := LoadCursor(hInstance, pChar('CURSOR_8'));
- screen.cursors[9] := LoadCursor(hInstance, pChar('CURSOR_9'));
- screen.cursors[10]:= LoadCursor(hInstance, pChar('CURSOR_10'));
- {hands:}
- screen.cursors[11]:= LoadCursor(hInstance, pChar('FIST'));
- screen.cursors[12]:= LoadCursor(hInstance, pChar('GRABBR'));
- screen.cursors[13]:= LoadCursor(hInstance, pChar('HANDPNT'));
- screen.cursors[14]:= LoadCursor(hInstance, pChar('PULLHAND'));
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- begin screen.cursor := fist; end;
-
- procedure TForm1.Button2Click(Sender: TObject);
- begin screen.cursor:=grab; end;
-
- procedure TForm1.Button3Click(Sender: TObject);
- begin screen.cursor:=poin; end;
-
- procedure TForm1.Button4Click(Sender: TObject);
- begin screen.cursor:=pull; end;
-
- procedure TForm1.Button5Click(Sender: TObject);
- begin screen.cursor:=crDefault; end;
-
-
- procedure TForm1.Button6Click(Sender: TObject);
- {Note: When the sand runs out a small Cross appears
- in the top of the hourglass to remind us of the
- temporal nature of this realm}
- var
- HGstate:integer;
- i,j:longint;
- begin
- HGstate:=1;
- for i:= 1 to 80 do
- begin
- inc(HGstate);
- if HGstate>10 then HGstate:=1;
- screen.cursor:=HGstate;
- for j:= 1 to 500000 do
- begin
- {do some work}
- end;
- end;
- screen.cursor:=crDefault;
- Application.processMessages;
- end;
-
- end.
-