home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / delphi / RTREGIST / DEMOS / DCU / UNIT3.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-10-14  |  1.4 KB  |  76 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.    RtRegb, 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.       Lock := RadioGroup1.ItemIndex+1;
  56.        case Lock of
  57.           1: if not RTSetCountLock(cPrg,i) then
  58.              begin
  59.                 ShowMessage('Could not set the Count Lock.'+#13#10+'Bye, bye!');
  60.                  i := 0;
  61.             end;
  62.           2: if not RTSetDateLock(cPrg,i) then
  63.              begin
  64.                 ShowMessage('Could not set the Date Lock.'+#13#10+'Bye, bye!');
  65.                  i := 0;
  66.             end;
  67.       end;
  68.        Cnt := i;
  69.         Close;
  70.     end
  71.    else
  72.           MessageDlg('The number of calls/days must be greater then 0!',mtError,[mbOk],0);
  73. end;
  74.  
  75. end.
  76.