home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pctchnqs / 1991 / number2 / dial.pas < prev    next >
Pascal/Delphi Source File  |  1990-10-10  |  986b  |  44 lines

  1. unit Dial;
  2.  
  3. Interface
  4.  
  5. function GetPhoneNum: String;
  6.  
  7. Implementation
  8.  
  9. uses Drivers, App, Dialogs, Views, Objects;
  10.  
  11. const
  12.   hnDialHist = 1;
  13.  
  14. function GetPhoneNum: String;
  15. var
  16.   Dialog: PDialog;
  17.   Control: PView;
  18.   R: TRect;
  19.   PhoneString: string[25];
  20. begin
  21.   R.Assign(20, 5, 50, 12);
  22.   Dialog := New(PDialog, Init(R, 'Enter phone number'));
  23.   with Dialog^ do
  24.   begin
  25.     R.Assign(2, 2, 24, 3);
  26.     Control := New(PInputLine, Init(R, 25));
  27.     Insert(Control);
  28.     R.Assign(25, 2, 28, 3);
  29.     Insert(New(PHistory, Init(R, PInputLine(Control), hnDialHist)));
  30.     R.Assign(2, 4, 12, 6);
  31.     Insert(New(PButton, Init(R, 'O~k~', cmOK, bfDefault)));
  32.     R.Assign(16, 4, 26, 6);
  33.     Insert(New(PButton, Init(R, 'Cancel', cmCancel, bfNormal)));
  34.     SelectNext(False);
  35.   end;
  36.   if DeskTop^.ExecView(Dialog) = cmCancel then GetPhoneNum := ''
  37.   else begin
  38.     Dialog^.GetData(PhoneString);
  39.     GetPhoneNum := PhoneString;
  40.   end;
  41.   Dialog^.Done;
  42. end;
  43. end.
  44.