home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 August / VPR9708A.ISO / D3TRIAL / INSTALL / DATA.Z / INPTFORM.PAS < prev    next >
Pascal/Delphi Source File  |  1997-03-21  |  1KB  |  55 lines

  1. unit inptform;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TInputForm = class(TForm)
  11.     Button1: TButton;
  12.     Button2: TButton;
  13.     PromptLabel: TLabel;
  14.     InputEdit: TEdit;
  15.   private
  16.     { Private declarations }
  17.     function Execute: Boolean;
  18.  
  19.   public
  20.     { Public declarations }
  21.     function GetString(prompt: string; var s: string): Boolean;
  22.     function GetInteger(prompt: string; var i: Integer): Boolean;
  23.   end;
  24.  
  25. var
  26.   InputForm: TInputForm;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. function TInputForm.Execute: Boolean;
  33. begin
  34.   InputEdit.Text := '';
  35.   Result := ShowModal = mrOk;
  36. end;
  37.  
  38. function TInputForm.GetString(prompt: string; var s: string): Boolean;
  39. begin
  40.   PromptLabel.Caption := prompt;
  41.   Result := InputForm.Execute;
  42.   if Result then
  43.     s := InputEdit.Text;
  44. end;
  45.  
  46. function TInputForm.GetInteger(prompt: string; var i: Integer): Boolean;
  47. begin
  48.   PromptLabel.Caption := prompt;
  49.   Result := InputForm.Execute;
  50.   if Result then
  51.     i := StrToInt(InputEdit.Text);
  52. end;
  53.  
  54. end.
  55.