home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_01_02 / 1n02064a < prev    next >
Text File  |  1990-07-09  |  2KB  |  53 lines

  1.  
  2.    #LOGiiX
  3.    {Dialog Box Query Example}
  4.    function main()
  5.    begin
  6.      result := Answer(3,"Yes, No, Cancel","Do you want to Print this Document?");
  7.      If (result = 6) then
  8.         begin
  9.           DoMenu("Print...");
  10.         end
  11.      else if (result = 7) then
  12.         begin
  13.             result2 := Answer(4,"Yes/No","Do you want to Open a File?");
  14.             if (result2 = 6) then
  15.             begin
  16.                     DoMenu("Open...");
  17.             end
  18.             else if (result2 = 7) then
  19.             begin
  20.                     MessageBox("  OK. Bye!");
  21.             end;
  22.         end;
  23.     end
  24.  
  25.     #LOGiiX
  26.     {Command to log user name, date, and time to a file}
  27.     function main()
  28.     begin
  29.         {Setup Strings}
  30.         String1 := "This function will ask for your name, then\n";
  31.         String2 := "create a log file with your name and the\n";
  32.         String3 := "date and time you activated the button\n";
  33.         String4 := "Do you want to continue?";
  34.         ret :="\n";
  35.  
  36.         {Display descriptive dialog box}
  37.         result := Answer(4,"Logging Command",String1+String2+String3+String4);
  38.         If (result = 6) then {If YES go on}
  39.         begin
  40.            hText := Open("LOG.GUI",0,0); {Open log file - invisible}
  41.            hTop := GetFocus(hText);
  42.            name := Ask("Karen Watterson","Enter your name, Please"); {Accept name input}
  43.            time := DateTime(); {Set time string}
  44.            buffer := " selected the button at "; {Set static text}
  45.            SetSelection(hText,hTop,65535,65535); {Set insert point to end of file}
  46.            InsertText(hText,name+buffer+time+ret); {Write data to file}
  47.            MessageBox(name+buffer+time); {Display what was written}
  48.            MessageBox("Look at the file LOG.GUI to see the entries");
  49.            Close(hText,1+256); {Close file & save all changes}
  50.         end;
  51.     end
  52.  
  53.