home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / ctenari / Hadraba / Source / EventForm.pas < prev    next >
Pascal/Delphi Source File  |  2002-08-12  |  2KB  |  87 lines

  1. unit EventForm;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   ExtCtrls, Buttons, StdCtrls, Menus;
  8.  
  9. const
  10.   ARE_CantExec = 1;
  11.  
  12. type
  13.   TEventForm1 = class(TForm)
  14.     Panel1: TPanel;
  15.     EventStaticText1: TStaticText;
  16.     OKSpeedButton1: TSpeedButton;
  17.     PopupMenu1: TPopupMenu;
  18.     Close1: TMenuItem;
  19.     procedure OnMoveOnScreen(Sender : TObject; Button : TMouseButton;
  20.       Shift : TShiftState; X, Y : Integer);
  21.     procedure FormKeyDown(Sender: TObject; var Key: Word;
  22.       Shift: TShiftState);
  23.     procedure Close1Click(Sender: TObject);
  24.     procedure OKSpeedButton1Click(Sender: TObject);
  25.   private
  26.     { Private declarations }
  27.   public
  28.     procedure Execute(AEvent : Cardinal);
  29.   end;
  30.  
  31. var
  32.   EventForm1: TEventForm1;
  33.  
  34. implementation
  35.  
  36. {$R *.DFM}
  37.  
  38. const
  39.   S_CantExec : String = 'AutoRun can''t execute selected item.';
  40.  
  41. procedure TEventForm1.Execute(AEvent : Cardinal);
  42. begin
  43.   case AEvent of
  44.     ARE_CantExec:
  45.       begin
  46.       Caption                  := S_CantExec;
  47.       EventStaticText1.Caption := S_CantExec;
  48.       end;
  49.   end;
  50.   ShowModal;
  51. end;
  52.  
  53. procedure TEventForm1.OnMoveOnScreen(Sender : TObject; Button : TMouseButton;
  54.   Shift : TShiftState; X, Y : Integer);
  55. var
  56.   Point : TPoint;
  57. begin
  58.   If Button = mbLeft then
  59.     begin
  60.     Point.x := X;
  61.     Point.y := Y;
  62.     ReleaseCapture;
  63.     SendMessage(Handle, wm_NCLButtonDown, htCaption, Integer(@Point));
  64.     end;
  65. end;
  66.  
  67. procedure TEventForm1.FormKeyDown(Sender: TObject; var Key: Word;
  68.   Shift: TShiftState);
  69. begin
  70.   case Key of
  71.     VK_Return, VK_Space, VK_Escape:
  72.       Close;
  73.   end;
  74. end;
  75.  
  76. procedure TEventForm1.Close1Click(Sender: TObject);
  77. begin
  78.   Close;
  79. end;
  80.  
  81. procedure TEventForm1.OKSpeedButton1Click(Sender: TObject);
  82. begin
  83.   Close;
  84. end;
  85.  
  86. end.
  87.