home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / tttdem51.zip / PULLDEM3.PAS < prev    next >
Pascal/Delphi Source File  |  1989-01-31  |  4KB  |  125 lines

  1. Program PullTTT5_Demo_3;
  2.  
  3. {This program is very similar to Pulldem1.pas and Pulldem2.pas. The main 
  4.  difference is that a User Hook has been added}
  5.  
  6. Uses CRT, DOS, FastTTT5, WinTTT5, KeyTTT5, PullTTT5;
  7.  
  8. var
  9.     TheMenu : Pull_Array;   {Array holding the menu definitions}
  10.     Major,Minor : byte;
  11.  
  12.  
  13.       {$F+}
  14.       Procedure Menu_Help(Var ChM:Char;PickM,PickS : byte);
  15.       {an example of how to hook other procedures into the menu system}
  16.       var Ch : char;
  17.       begin
  18.          If ChM = #187 then
  19.          begin
  20.             MkWin(20,7,60,15,white,red,1);
  21.             WriteAT(22,9,white,red,'This could be context sensitive');
  22.             WriteAT(22,10,white,red,'about the highlighted pick:');
  23.             GotoXY(25,12);Write('Main Pick ',PickM);
  24.             GotoXY(25,13);Write('Sub  Pick ',PickS);
  25.             Ch := GetKey;
  26.             RmWin;
  27.          end;
  28.       end;
  29.       {$F-}
  30.  
  31.       Procedure Define_Demo_Menu;
  32.       begin
  33.          Fillchar(TheMenu,sizeof(TheMenu),#0);    {Empty the array}
  34.          TheMenu[1] := '\File';      {menu definition for pull down menu}
  35.          TheMenu[2] := 'Load        ';
  36.          TheMenu[2] := 'Pick        ';
  37.  
  38.          TheMenu[3] := 'New         ';
  39.          TheMenu[4] := 'Save        ';
  40.          TheMenu[5] := 'Write to    ';
  41.          TheMenu[6] := 'Directory   ';
  42.          TheMenu[7] := 'Change dir  ';
  43.          TheMenu[8] := 'OS shell    ';
  44.          TheMenu[9] := 'Quit        ';
  45.  
  46.          TheMenu[10] :=  '\Edit ';
  47.  
  48.          TheMenu[11] :=  '\Run ';
  49.          TheMenu[12] :=  'Program reset ';
  50.          TheMenu[13] :=  'Go to cursor  ';
  51.          TheMenu[14] :=  'Trace into    ';
  52.          TheMenu[15] :=  ' Step Over    ';
  53.          TheMenu[16] :=  'User Screen   ';
  54.  
  55.          TheMenu[17] := '\Compile';
  56.          TheMenu[18] := 'Compile      ';
  57.          TheMenu[19] := 'Make         ';
  58.          TheMenu[20] := 'Build        ';
  59.          TheMenu[21] := 'Destination  ';
  60.          TheMenu[22] := 'Find Error   ';
  61.          TheMenu[23] := 'Primary file ';
  62.          TheMenu[24] := 'Get Info     ';
  63.  
  64.          TheMenu[25] := '\Options';
  65.          TheMenu[26] := 'Compiler        ';
  66.          TheMenu[27] := 'Linker          ';
  67.          TheMenu[28] := 'Environment     ';
  68.          TheMenu[29] := 'Directories     ';
  69.          TheMenu[30] := 'Parameters      ';
  70.          TheMenu[31] := 'Save Options    ';
  71.          TheMenu[32] := 'Retrieve Options';
  72.  
  73.          TheMenu[22] := '\Debug';
  74.          TheMenu[23] := 'Evaluate              ';
  75.          TheMenu[23] := 'Call stack            ';
  76.          TheMenu[24] := 'Find procedure        ';
  77.          TheMenu[25] := 'Integrated debugging  ';
  78.          TheMenu[26] := 'Stand-alone debugging ';
  79.          TheMenu[27] := 'Display Swapping      ';
  80.          TheMenu[28] := 'Refresh display       ';
  81.  
  82.          TheMenu[29] := '\Break/Watch';
  83.          TheMenu[30] := 'Add Watch             ';
  84.          TheMenu[31] := 'Delete Watch          ';
  85.          TheMenu[32] := 'Edit Watch            ';
  86.          TheMenu[33] := 'Remove all watches    ';
  87.          TheMenu[34] := 'Toggle breakpoint     ';
  88.          TheMenu[35] := 'Clear all breakpoints ';
  89.          TheMenu[36] := 'View next breakpoint  ';
  90.  
  91.          TheMenu[37] := '\\';
  92.       end; {Proc Define demo menu}
  93.  
  94.  
  95. begin   {main demo program}
  96.     Define_Demo_Menu;
  97.     Major := 1;
  98.     Minor := 4;
  99.     FillScreen(1,1,80,25,white,blue,chr(177));
  100.     WriteAt(25,9,yellow,blue,'Press F1 for Help');
  101.     {$IFDEF VER50}
  102.     PTTT.Hook := Menu_Help;
  103.     {$ELSE}
  104.     PM_UserHook := @Menu_Help;
  105.     {$ENDIF}
  106.     With PTTT do      {modify the display characteristics}
  107.     begin
  108.         Style := 0;  {0 no border, 1 single border, 2 double border}
  109.         TopX :=  1;
  110.         TopY := 2;
  111.         Gap :=  5;
  112.         AlwaysDown := true;
  113.     end; {With}
  114.     Pull_Menu(TheMenu,Major,Minor);
  115.     Clrscr;
  116.     If Major = 0 then
  117.        Write('You escaped')
  118.     else
  119.        Write('You selected main menu ',Major,' and sub-topic ',Minor);
  120.     WriteAT(1,4,white,black,'Run DemoTTT.exe for the main demo program');
  121.     WriteAT(1,5,white,black,'TechnoJock''s Turbo Toolkit v5.0');
  122.     GotoXY(1,7);
  123. end.
  124.  
  125.