home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Runimage / Delphi50 / Source / Samples / IBEVNTS.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-08-11  |  2.1 KB  |  80 lines

  1. {********************************************************}
  2. {                                                        }
  3. {       Borland Deplphi                                  }
  4. {       InterBase EventAlerter components                }
  5. {       Copyright (c) 1995,99 Inprise Corporation        }
  6. {                                                        }
  7. {       Written by:                                      }
  8. {         James Thorpe                                   }
  9. {         CSA Australasia                                }
  10. {         Compuserve: 100035,2064                        }
  11. {         Internet:   csa@csaa.com.au                    }
  12. {                                                        }
  13. {********************************************************}
  14.  
  15. unit Ibevnts;
  16.  
  17. interface
  18.  
  19. uses
  20.   SysUtils, Windows, Messages, Classes, Graphics, Controls,
  21.   Forms, Dialogs, ExtCtrls, StdCtrls, Grids, IBCtrls;
  22.  
  23. type
  24.   TIBEAEventsEditor = class(TForm)
  25.     Panel1: TPanel;
  26.     Panel2: TPanel;
  27.     cEvents: TStringGrid;
  28.     RequestedEvents: TLabel;
  29.     bOK: TButton;
  30.     bCancel: TButton;
  31.     procedure FormCreate(Sender: TObject);
  32.   private
  33.     { Private declarations }
  34.   public
  35.     { Public declarations }
  36.   end;
  37.  
  38. function EditAlerterEvents( Events: TStrings): Boolean;
  39.  
  40. var
  41.   IBEAEventsEditor: TIBEAEventsEditor;
  42.  
  43. implementation
  44.  
  45. {$R *.DFM}
  46.  
  47. function EditAlerterEvents( Events: TStrings): Boolean;
  48. var
  49.   i: integer;
  50. begin
  51.   result := false;
  52.   with TIBEAEventsEditor.Create(Application) do
  53.   begin
  54.     try
  55.       for i := 0 to Events.Count-1 do
  56.         cEvents.Cells[1, i] := Events[i];
  57.       if ShowModal = idOk then
  58.       begin
  59.         result := true;
  60.         Events.Clear;
  61.         for i := 0 to MaxEvents-1 do
  62.           if length( cEvents.Cells[1, i]) <> 0 then
  63.             Events.Add( cEvents.Cells[1, i]);
  64.       end;
  65.     finally
  66.       Free;
  67.     end;
  68.   end;
  69. end;
  70.  
  71. procedure TIBEAEventsEditor.FormCreate(Sender: TObject);
  72. var
  73.   i: integer;
  74. begin
  75.   for i := 1 to MaxEvents do
  76.     cEvents.Cells[0, i-1] := IntToStr( i);
  77. end;
  78.  
  79. end.
  80.