home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TJOCKREF.ZIP / MENUTTT.TXT < prev    next >
Encoding:
Text File  |  1988-08-22  |  2.8 KB  |  86 lines

  1. !SHORT:DisplayMenu       Display a formatted menu window
  2. DisplayMenu                                                    MenuTTT
  3.      
  4.  
  5.  
  6. Purpose   To display a highly formatted menu window.
  7.  
  8. Declaration    Displaymenu(MenuDef: menu_record;
  9.                Window: boolean;
  10.                var Choice,Retcode: integer);
  11.                
  12.           MenuDef - the name of the menu record.
  13.                
  14.           Window - when true indicates the screen prior to menu
  15.           display should be restored after menu completion.
  16.  
  17.           Choice is returned with the users menu selection. The
  18.           variable should be initialized to the menu pick that should
  19.           be highlighted when the menu is first displayed.
  20.                
  21.           Retcode is returned with a value of zero if the execution
  22.           was successful, or 1 if the user pressed Esc and AllowEsc
  23.           was enabled.
  24.  
  25. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, MenuTTT.
  26.  
  27.  
  28.  
  29. Example    Program Menu_Demo;
  30.  
  31.            Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, MenuTTT;
  32.  
  33.            var
  34.            M : menu_record;
  35.            Choice, Retcode : integer;
  36.            Ch : char;
  37.  
  38.            Procedure Define_M;
  39.            begin
  40.              With M do
  41.              begin
  42.                Heading1 := 'TechnoJocks';
  43.                Heading2 := 'Menu';
  44.                Topic[1]  := '  Help';
  45.                Topic[2]  := '  Load Database';
  46.                Topic[3]  := '  Re-index Database ';
  47.                Topic[4]  := '  Input new Data';
  48.                Topic[5]  := '  Save Database';
  49.                Topic[6]  := '  Print Reports';
  50.                Topic[7]  := '  Quit';
  51.                TotalPicks := 7;
  52.                PicksPerLine := 1;
  53.                AddPrefix := 3;
  54.                TopleftXY[1] := 0;
  55.                TopLeftXY[2] := 4;
  56.                BoxType := 5;
  57.                Margins := 5;
  58.                Colors[1] := white;
  59.                Colors[2] := red;
  60.                Colors[3] := lightgray;
  61.                Colors[4] := blue;
  62.                Colors[5] := lightcyan;
  63.                AllowEsc := true;
  64.              end;
  65.            end;
  66.  
  67.            begin
  68.              Fillscreen(1,1,80,25,white,blue,chr(177));
  69.              ClearLine(25,white,black);
  70.              WriteCenter(25,lightgray,black,'TechnoJocks Turbo Toolkit');
  71.              Choice := 1;
  72.              Define_M;
  73.              DisplayMenu(M,False,Choice,Retcode);
  74.              writeln;
  75.              GotoXY(1,20);
  76.              If Retcode = 0 then
  77.                Writeln('You chose option ',Choice)
  78.              else
  79.                Writeln('You escaped!');
  80.                WriteAT(1,22,white,black,'Run DemoTTT.exe for the main demo program');
  81.                WriteAT(1,23,white,black,'Technojocks Turbo Toolkit v4.0');
  82.                Ch := Readkey;
  83.            end.
  84.  
  85. !SEEALSO:PullTTT.ngo:Pull_Menu
  86.