home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_01 / 2n01044b < prev    next >
Text File  |  1990-06-26  |  2KB  |  77 lines

  1. (*
  2.         Test Driver for Graphical Radio-Button Panel
  3.  
  4.         Turbo Pascal 4 Program
  5.  
  6.         **************************************************
  7.         NOTE:   All compilations should have the boolean
  8.                 evaluation option set to "short-circuit"
  9.         **************************************************
  10.                 
  11.         June 26, 1990  --  Michael Kelly  --  Version 1.01      *)
  12.  
  13. Program TryMenu;
  14. Uses GuiMenu, Panel, Graph, Int16, Crt;
  15.  
  16.     Var
  17.         ThisMenu : PanelMenu;
  18.  
  19. Procedure SetUp;    { Load the PanelMenu with option strings }
  20.  
  21. Begin
  22.   ThisMenu[1] := 'Turbo Pascal 4 GUI';
  23.   ThisMenu[2] := '';
  24.   ThisMenu[3] := 'A Graphical Radio-Button';
  25.   ThisMenu[4] := '';
  26.   ThisMenu[5] := 'Panel Prototype';
  27.   ThisMenu[6] := '';
  28.   ThisMenu[7] := 'Click on a Button';
  29.   ThisMenu[8] := 'or Press the Enter Key';
  30.   ThisMenu[9] := '';
  31.   ThisMenu[MaxButton] := 'Quit';
  32. End;
  33. (* SetUp *)
  34.  
  35. Procedure Dispatch;     { Process user selection returned by MainMenu }
  36.     Var
  37.         k         : Integer;
  38.     ascii, scan     : Byte;
  39.     str        : ButtonTag;
  40.  
  41. Begin
  42.   Repeat
  43.     k := MainMenu(ThisMenu);
  44.     If k = -1 then  { -1 indicates an error has occurred }
  45.     Begin
  46.       CloseMenu;
  47.       WriteLn;
  48.       WriteLn('Error Initializing Graphics Menu');
  49.       WriteLn;
  50.       WriteLn('Program Requires Ega or Vga Graphics Adaptor');
  51.       Halt;
  52.     End;
  53.     If k in[1..9] then
  54.     Begin
  55.       str := #39;
  56.       str := str + ThisMenu[k];
  57.       str := str + #39;
  58.       OutTextXY(10, 310,'You Pressed ...');
  59.       OutTextXY(10, 320, str);
  60.       OutTextXY(10, 330, '( Press Any Key ... )');
  61.       get_key(ascii, scan);
  62.     End;
  63.   Until k = MaxButton;  { In this example, bottom selection is 'Quit' option }
  64.   delay(500);
  65.   CloseMenu;    { Restore video state }
  66. End;
  67. (* Dispatch *)
  68.  
  69.  
  70.  
  71. {  Main  }
  72.  
  73. Begin
  74.   SetUp;
  75.   Dispatch;
  76. End.
  77.