home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April A / Pcwk4a98.iso / PROGRAM / DELPHI16 / Animcur / FORM.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-01-12  |  3.3 KB  |  119 lines

  1. unit Form;
  2. {
  3. Task:     Change & Animate Mouse Cursors
  4. Author:   Doug Colman (doug@neumann.une.edu.au)
  5. Date:     January 12th 1996
  6. Version:  1.0
  7. Compiler: Borland Delphi 1.0
  8. Input:    User Clicks
  9. Output:   Cute Mouse Cursors
  10. }
  11.  
  12. interface
  13.  
  14. uses
  15.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  16.   Forms, Dialogs, StdCtrls, ExtCtrls;
  17.  
  18. type
  19.   TForm1 = class(TForm)
  20.     Button1: TButton;
  21.     Label1:  TLabel;
  22.     Button2: TButton;
  23.     Button3: TButton;
  24.     Button4: TButton;
  25.     Button5: TButton;
  26.     Button6: TButton;
  27.     procedure FormCreate(Sender: TObject);
  28.     procedure Button1Click(Sender: TObject);
  29.     procedure Button2Click(Sender: TObject);
  30.     procedure Button3Click(Sender: TObject);
  31.     procedure Button4Click(Sender: TObject);
  32.     procedure Button5Click(Sender: TObject);
  33.     procedure Button6Click(Sender: TObject);
  34.   private
  35.     { Private declarations }
  36.   public
  37.     { Public declarations }
  38.   end;
  39.  
  40. var
  41.   Form1: TForm1;
  42.  
  43. implementation
  44.  
  45. {$R *.DFM}
  46. {Bind cursors to EXE:}
  47. {$R handzpd.res}
  48. {$R hourgzpd.res}
  49.  
  50. {Cursors are loaded into RES file via Image Editor OR Resource Workshop}
  51.  
  52. const hg1=1; const hg2=2; const hg3=3; const hg4=4; const hg5=5;
  53. const hg6=6; const hg7=7; const hg8=8; const hg9=9; const hg10=10;
  54. const fist = 11; {arbitrary number}
  55. const grab = 12;
  56. const poin = 13;
  57. const pull = 14;
  58.  
  59. procedure TForm1.FormCreate(Sender: TObject);
  60. begin
  61.   {spinning hourglass:}
  62.   screen.cursors[1] := LoadCursor(hInstance, pChar('CURSOR_1'));
  63.   screen.cursors[2] := LoadCursor(hInstance, pChar('CURSOR_2'));
  64.   screen.cursors[3] := LoadCursor(hInstance, pChar('CURSOR_3'));
  65.   screen.cursors[4] := LoadCursor(hInstance, pChar('CURSOR_4'));
  66.   screen.cursors[5] := LoadCursor(hInstance, pChar('CURSOR_5'));
  67.   screen.cursors[6] := LoadCursor(hInstance, pChar('CURSOR_6'));
  68.   screen.cursors[7] := LoadCursor(hInstance, pChar('CURSOR_7'));
  69.   screen.cursors[8] := LoadCursor(hInstance, pChar('CURSOR_8'));
  70.   screen.cursors[9] := LoadCursor(hInstance, pChar('CURSOR_9'));
  71.   screen.cursors[10]:= LoadCursor(hInstance, pChar('CURSOR_10'));
  72.   {hands:}
  73.   screen.cursors[11]:= LoadCursor(hInstance, pChar('FIST'));
  74.   screen.cursors[12]:= LoadCursor(hInstance, pChar('GRABBR'));
  75.   screen.cursors[13]:= LoadCursor(hInstance, pChar('HANDPNT'));
  76.   screen.cursors[14]:= LoadCursor(hInstance, pChar('PULLHAND'));
  77. end;
  78.  
  79. procedure TForm1.Button1Click(Sender: TObject);
  80.   begin screen.cursor := fist; end;
  81.  
  82. procedure TForm1.Button2Click(Sender: TObject);
  83.   begin screen.cursor:=grab; end;
  84.  
  85. procedure TForm1.Button3Click(Sender: TObject);
  86.   begin screen.cursor:=poin; end;
  87.  
  88. procedure TForm1.Button4Click(Sender: TObject);
  89.   begin screen.cursor:=pull; end;
  90.  
  91. procedure TForm1.Button5Click(Sender: TObject);
  92.   begin screen.cursor:=crDefault; end;
  93.  
  94.  
  95. procedure TForm1.Button6Click(Sender: TObject);
  96. {Note: When the sand runs out a small Cross appears
  97.   in the top of the hourglass to remind us of the
  98.   temporal nature of this realm}
  99. var
  100.   HGstate:integer;
  101.   i,j:longint;
  102. begin
  103.   HGstate:=1;
  104.   for i:= 1 to 80 do
  105.   begin
  106.     inc(HGstate);
  107.     if HGstate>10 then HGstate:=1;
  108.     screen.cursor:=HGstate;
  109.     for j:= 1 to 500000 do
  110.     begin
  111.       {do some work}
  112.     end;
  113.   end;
  114.   screen.cursor:=crDefault;
  115.   Application.processMessages;
  116. end;
  117.  
  118. end.
  119.