home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / ULDIAL.ZIP / TESTDIAL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1990-06-24  |  2.5 KB  |  93 lines

  1. {$A-,B-,E+,F+,I+,N-,O+,R+,S+,V-}
  2. {$M 32000,64000,655360}
  3.  
  4. { Test Program for testing ULDial }
  5.  
  6. Program TESTDIAL;
  7.  
  8. Uses DOS, OpCrt, OpString, OpFrame, OpWindow, OpKey,
  9.      ULRoot, ULDial;
  10.  
  11. label
  12.   Again;
  13.  
  14. var
  15.   Msg : string;
  16.   Choices : string;
  17.   Prompt : string;
  18.   Len : byte absolute Prompt;
  19.   EditSt : string;
  20.   ExitCode : word;
  21.   TimeOut : word;
  22.   N : longint;
  23.   Dial : DialogBox;
  24.   Error : word;
  25.  
  26. begin
  27.   N := MemAvail;
  28.   InitCrt;
  29.   with ULRootColorSet do
  30.   TextAttr := ColorMono(HotSpotColor, HotSpotMono);
  31.   { Initialize the DialogBox for upto 3 lines of text upto 78 chars wide and
  32.     upto 4 choices upto 10 chars wide each.}
  33.   if not Dial.Init(3,234,4,40) then
  34.   begin
  35.     WriteLn('Insufficient memory.');
  36.     Halt(1);
  37.   end;
  38. Again:
  39.   ClrScr;
  40.   WriteLn('Test of DialogBox.');
  41.   WriteLn('Enter 2 or 3 lines of text that you want used for message.');
  42.   WriteLn('Use blank line to end.');
  43.   EditSt := '';
  44.   with Dial do
  45.   begin
  46.     AddHeader(' DialogBox ',heTC);
  47.     repeat
  48.       Write('═');
  49.       ReadLn(Msg);
  50.       if Msg <> '' then AddMessageString(Msg);
  51.     until Msg = '';
  52.     WriteLn('Enter up to 4 choices you want displayed for exiting.');
  53.     WriteLn('Separate each word used for choice with a space.');
  54.     Write('═');
  55.     ReadLn(Choices);
  56.     AddChoiceString(Choices);
  57.     WriteLn('If you want a string entry field, enter a 2 or 3 word prompt.');
  58.     WriteLn('If you do not want an entry field, enter a blank line.');
  59.     Write('═');
  60.     ReadLn(Prompt);
  61.     if Prompt <> '' then
  62.       AddStringEntryField(Prompt,1,1,CharStr('X',78),1,Len+2,60-Len,0,EditSt);
  63.     WriteLn('If you want an automatic timeout, enter number of millisecond delay.');
  64.     WriteLn('Enter 0 to disable this function.');
  65.     ReadLn(TimeOut);
  66.     SetTimeOut(TimeOut);
  67.     Error := GetLastError;
  68.     if Error <> 0 then
  69.     begin
  70.       WriteLn('Error: ', Error);
  71.       Halt(1);
  72.     end;
  73.     Process;
  74.     ExitCode := GetLastChoice;
  75.     EditSt := GetEditedString;
  76.     Done;
  77.   end;
  78.   WriteLn('You exited with code: ',ExitCode);
  79.   if Prompt <> '' then
  80.     WriteLn('The edited string was: ', EditSt);
  81.   WriteLn('Press {Enter} to go again; any other key to quit...');
  82.   ExitCode := ReadKeyWord;
  83.   if ExitCode = Enter then
  84.   begin
  85.     Dial.Clear;
  86.     Goto Again;
  87.   end;
  88.   wStack.Done;  { If you don't use this, you eat up 40 bytes of the heap.}
  89.   RestoreCrt;
  90.   WriteLn('Memory Available: Start:', N);
  91.   WriteLn('                 Finish:',MemAvail);
  92. end.
  93.