home *** CD-ROM | disk | FTP | other *** search
/ Delphi 4 Bible / Delphi_4_Bible_Tom_Swan_IDG_Books_1998.iso / source / Actions / Main.pas < prev   
Pascal/Delphi Source File  |  1998-04-20  |  1KB  |  52 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls,
  7.   Forms, Dialogs, Menus, ActnList, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     MainMenu1: TMainMenu;
  12.     Edit1: TEdit;
  13.     Button1: TButton;
  14.     Label1: TLabel;
  15.     ActionList1: TActionList;
  16.     Demo1: TMenuItem;
  17.     Exit1: TMenuItem;
  18.     ExitAction: TAction;
  19.     procedure ExitActionExecute(Sender: TObject);
  20.     procedure ExitActionUpdate(Sender: TObject);
  21.   private
  22.     { Private declarations }
  23.   public
  24.     { Public declarations }
  25.   end;
  26.  
  27. var
  28.   Form1: TForm1;
  29.  
  30. implementation
  31.  
  32. {$R *.DFM}
  33.  
  34. procedure TForm1.ExitActionExecute(Sender: TObject);
  35. begin
  36.   Close;  // Exit program
  37. end;
  38.  
  39. procedure TForm1.ExitActionUpdate(Sender: TObject);
  40. var
  41.   Flag: Boolean;
  42. begin
  43. // Set Flag True if user types Quit into Edit1
  44.   if Lowercase(Edit1.Text) = 'quit'
  45.     then Flag := True
  46.     else Flag := False;
  47.   Button1.Enabled := Flag;  // Enable or disable Button1
  48.   Exit1.Enabled := Flag;    // Enable or disable Menu item
  49. end;
  50.  
  51. end.
  52.