home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / delphi / RTREGIST / DEMOS / VCL / UNIT3.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-10-14  |  1.4 KB  |  75 lines

  1. unit Unit3;
  2.  
  3. interface
  4.  
  5. uses
  6.     SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.     Forms, Dialogs, StdCtrls, ExtCtrls;
  8.  
  9. type
  10.     TNewForm1 = class(TForm)
  11.     RadioGroup1: TRadioGroup;
  12.     Edit1: TEdit;
  13.     Label1: TLabel;
  14.     Button1: TButton;
  15.     procedure Button1Click(Sender: TObject);
  16.     private
  17.         { Private-Deklarationen }
  18.     public
  19.         { Public-Deklarationen }
  20.     end;
  21.  
  22. procedure SetLock;
  23.  
  24. implementation
  25.  
  26. uses
  27.    Unit1;
  28.  
  29. {$R *.DFM}
  30.  
  31. procedure SetLock;
  32. var
  33.     NewForm: TNewForm1;
  34. begin
  35.     NewForm := TNewForm1.Create(Application);
  36.    try
  37.        NewForm.RadioGroup1.ItemIndex := 0;
  38.        NewForm.ShowModal;
  39.    finally
  40.        NewForm.Free;
  41.     end;
  42. end;
  43.  
  44. procedure TNewForm1.Button1Click(Sender: TObject);
  45. var
  46.     i: integer;
  47. begin
  48.     try
  49.        i := StrToInt(Edit1.Text);
  50.    except
  51.        i := 0;
  52.    end;
  53.    if i>0 then
  54.    begin
  55.       with Form1.RtRegControl1 do
  56.        case RadioGroup1.ItemIndex+1 of
  57.           1: begin
  58.                  CallsLeft := i;
  59.                if CallsLeft<=0 then
  60.                     ShowMessage('Could not set the Count Lock.'+#13#10+'Bye, bye!');
  61.             end;
  62.           2: begin
  63.                  DaysLeft := i;
  64.                if DaysLeft<=0 then
  65.                     ShowMessage('Could not set the Date Lock.'+#13#10+'Bye, bye!');
  66.             end;
  67.       end;
  68.         Close;
  69.     end
  70.    else
  71.           MessageDlg('The number of calls/days must be greater then 0!',mtError,[mbOk],0);
  72. end;
  73.  
  74. end.
  75.