home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / PULLDOWN.ZIP / PULLDEMO.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1987-02-27  |  21.2 KB  |  623 lines

  1. { PullDemo.pas - full-featured demo for PULL11.INC          ver 1.1, 02-27-87 }
  2.  
  3. { *****************************    STEP 1   ********************************* }
  4. {$C-}                        { Be sure to set this in your final program! }
  5. { Place storage limits on include files. }
  6. {$I qwik21.inc }
  7.  
  8. const
  9.   MaxWndw = 7;               { Max Number of Windows on display }
  10. {$I window32.inc }
  11.  
  12. const
  13.   MaxMenuLines     = 15;     { For Main and Sub menus }
  14.   MaxCharsPerLine  = 20;     { For Main and Sub menus }
  15.   MaxStringLength  = 80;     { To fill CRT }
  16.   NumOfMainMenus   =  8;
  17.   NumOfSubMenus    =  5;
  18.   NumOfDataWndws   =  6;
  19.   NumOfHelpWndws   =  7;
  20.   NumOfMsgLines    =  9;
  21.   NumOfErrMsgLines =  3;
  22.   MaxErrStrLength  = 40;     { Error messages are usually short }
  23.   TotalHelpLines   = 27;
  24.   HelpCharsPerLine = 50;
  25. {$I pull11.inc }
  26.  
  27. { *****************************    STEP 2   ********************************* }
  28. { This is all the configuration data.  It would probably be better as an
  29.   overlay, but haven't figured that out yet.  The program first clears all
  30.   RECORD values to $00.  The values below will set new values.  Therefore,
  31.   setting RECORD values to "false" or the like is not necessary. }
  32. procedure GetUserPullStats;
  33. begin
  34.   LocationWarning:=true;   { If true and a Submenu won't fit, a message is
  35.                              displayed.  If false, you can override the
  36.                              location without the message. }
  37.   CRTrows:=25;    { EGA users can make algorithm for this.  CRTcols is
  38.                     handled automatically. }
  39.  
  40.   { ------------------ Set up your colors and borders here: ---------------- }
  41.   TopMenuAttr:=  Attr(black,lightgray); TopHiLitAttr:= Attr(lightgray,black);
  42.   MainMenuWattr:=Attr(white,black);     MainMenuBattr:=Attr(lightgray,black);
  43.                                         MainHiLitAttr:=Attr(black,lightgray);
  44.   SubMenuWattr:= Attr(yellow,black);    SubMenuBattr:= Attr(brown,black);
  45.                         if Vmode=7 then SubHiLitAttr:= Attr(black,lightgray)
  46.                                    else SubHiLitAttr:= Attr(black,brown);
  47.   DataWndwWattr:=Attr(black,brown);     DataWndwBattr:=Attr(black,brown);
  48.   HelpWndwWattr:=Attr(black,green);     HelpWndwBattr:=Attr(black,lightgray);
  49.   MsgLineAttr:=  Attr(green,black);
  50.  
  51.   Brdr[UserBrdr]:=Brdr[MixedBrdr];
  52.   with Brdr[UserBrdr] do
  53.   begin
  54.     BL:=Brdr[SingleBrdr].BL;
  55.     BH:=Brdr[SingleBrdr].BH;
  56.     BR:=Brdr[SingleBrdr].BR
  57.   end;
  58.   MainMenuBrdr:=UserBrdr;               SubMenuBrdr :=SingleBrdr;
  59.   DataWndwBrdr:=MixedBrdr;              HelpWndwBrdr:=MixedBrdr;
  60.   HelpZoom:=true;                       HelpShadow:=Right;
  61.   RowsBelowHelp:=4;                     RowsBelowMsg:=0;
  62.  
  63.   { ------------------------- Top Menu defaults ----------------------------- }
  64.   TopMenuRow:=2;        { Top menu to appear on row 2 }
  65.   MPulled:=1;           { Main menu title to be HiLited; }
  66.   CmdSeq:='ATB';        { Sequence of command letter(s) as if keyed in.  This }
  67.                         { will be the default menu(s) pulled. (No '/' needed) }
  68.   Pull:=false;          { Set this true is you want the command sequence}
  69.                         {  to pull down the menus at startup. }
  70.  
  71.   { ------------------- Set up your MainMenu records here: ------------------ }
  72.   MainMenuRow:=3;       { Main menu to appear on row 3 }
  73.   with MainMenu[1] do
  74.   begin
  75.     MenuMode:=ExecChoice;
  76.     Title:='Files';
  77.     Line[1]:='Save';
  78.     Line[2]:='save As';         SelectMode[2]:=ToDataWndw;  LinkNum[2]:=6;
  79.     Line[3]:='text In';
  80.     Line[4]:='text Out';
  81.     Line[5]:='────────';        SelectMode[5]:=NoChoice;
  82.     Line[6]:='Merge';
  83.     Line[7]:='Get';             SelectMode[7]:=ToDataWndw;  LinkNum[7]:=6;
  84.     Line[8]:='Verify';
  85.     MenuLines:=8;               DefaultLine:=6;
  86.     MsgLineNum:=3;              HelpWndwNum:=3;
  87.   end;
  88.   with MainMenu[2] do
  89.   begin
  90.     MenuMode:=SingleChoice;     SingleSel:=2;
  91.     Title:='Color';
  92.     Line[1]:='Blue';
  93.     Line[2]:='Green';
  94.     Line[3]:='Orange';
  95.     Line[4]:='Yellow';
  96.     Line[5]:='Red';
  97.     Line[6]:='Cyan';
  98.     Line[7]:='Ultraviolet';
  99.     MenuLines:=7;               DefaultLine:=5;
  100.     MsgLineNum:=3;              HelpWndwNum:=4;
  101.   end;
  102.   with MainMenu[3] do
  103.   begin
  104.     MenuMode:=MultipleChoice;
  105.     Title:='AutoParts';
  106.     Line[1]:='Tires';           SelectMode[1]:=ToSubMenu;   LinkNum[1]:=1;
  107.     Line[2]:='Radio';           SelectMode[2]:=ToSubMenu;   LinkNum[2]:=2;
  108.     Line[3]:='Seats';           SelectMode[3]:=ToDataWndw;  LinkNum[3]:=1;
  109.     Line[4]:='Mirrors';         Selected[4]:=true;
  110.     Line[5]:='Locks';
  111.     Line[6]:='HiBeams';         Selected[6]:=true;
  112.     Line[7]:='Wheels';
  113.     MenuLines:=7;               DefaultLine:=1;
  114.     MsgLineNum:=3;              HelpWndwNum:=5;
  115.   end;
  116.   with MainMenu[4] do
  117.   begin
  118.     MenuMode:=MultipleChoice;
  119.     Title:='EnterData';
  120.     Line[1]:='Byte';            SelectMode[1]:=ToDataWndw;  LinkNum[1]:=1;
  121.     Line[2]:='Integer';         SelectMode[2]:=ToDataWndw;  LinkNum[2]:=2;
  122.     Line[3]:='Real';            SelectMode[3]:=ToDataWndw;  LinkNum[3]:=3;
  123.     Line[4]:='Character';       SelectMode[4]:=ToDataWndw;  LinkNum[4]:=4;
  124.     Line[5]:='String';          SelectMode[5]:=ToDataWndw;  LinkNum[5]:=5;
  125.     MenuLines:=5;               DefaultLine:=2;
  126.     MsgLineNum:=3;              HelpWndwNum:=5;
  127.   end;
  128.   with MainMenu[5] do
  129.   begin
  130.     MenuMode:=MultipleChoice;
  131.     Title:='Options';
  132.     Line[1]:='Dual drive';
  133.     Line[2]:='Hard disk';       Selected[2]:=true;
  134.     Line[3]:='Extended Mem';
  135.     Line[4]:='CGA';             Selected[4]:=true;
  136.     Line[5]:='MDA';
  137.     Line[6]:='KeyBoard';
  138.     Line[7]:='Price limit';     SelectMode[7]:=ToDataWndw;  LinkNum[7]:=2;
  139.     MenuLines:=7;               DefaultLine:=1;
  140.     MsgLineNum:=3;              HelpWndwNum:=5;
  141.   end;
  142.   with MainMenu[6] do
  143.   begin
  144.     MenuMode:=SingleChoice;     SingleSel:=3;
  145.     Title:='Directory';
  146.     Line[1]:='ansi    .sys';
  147.     Line[2]:='config  .sys';
  148.     Line[3]:='command .com';
  149.     Line[4]:='ibmio   .com';
  150.     Line[5]:='123     .bat';
  151.     Line[6]:='autoexec.bat';
  152.     Line[7]:='user    .bat';
  153.     MenuLines:=7;               DefaultLine:=2;
  154.     MsgLineNum:=3;              HelpWndwNum:=4;
  155.   end;
  156.   with MainMenu[7] do
  157.   begin
  158.     MenuMode:=ExecChoice;
  159.     Title:='IRSaccounting';
  160.     Line[1]:='Handling';
  161.     Line[2]:='Cost';
  162.     Line[3]:='Revenue';
  163.     Line[4]:='Taxes';
  164.     Line[5]:='Insurance';
  165.     Line[6]:='Update';          SelectMode[6]:=ToSubMenu;   LinkNum[6]:=3;
  166.     Line[7]:='Years';           SelectMode[7]:=ToDataWndw;  LinkNum[7]:=1;
  167.     MenuLines:=7;               DefaultLine:=1;
  168.     MsgLineNum:=3;              HelpWndwNum:=3;
  169.   end;
  170.   with MainMenu[8] do
  171.   begin
  172.     MenuMode:=ExecChoice;
  173.     Title:='Quit';
  174.     Line[1]:='Stay';
  175.     Line[2]:='Quit';
  176.     MenuLines:=2;               DefaultLine:=1;  BackToDefault:=true;
  177.     MsgLineNum:=3;              HelpWndwNum:=3;
  178.   end;
  179.  
  180.   { ----------------------- Set up your SubMenus here: --------------------- }
  181.   { Careful! -- indexes to SubMenus must be in order of level; i.e. ALL
  182.     SubMenus first, ALL SubSubMenus second, ALL SubSubSubMenus ...etc. }
  183.   with SubMenu[1] do
  184.   begin
  185.     MenuMode:=SingleChoice;     SingleSel:=5;
  186.     Line[1]:='Brands';          SelectMode[1]:=ToSubMenu;   LinkNum[1]:=4;
  187.     Line[2]:='Radials';
  188.     Line[3]:='Knobbies';
  189.     Line[4]:='Track';
  190.     Line[5]:='Snow';
  191.     Line[6]:='All-Weather';
  192.     Line[7]:='4-ply';
  193.     MenuLines:=7;               DefaultLine:=1;
  194.     MsgLineNum:=4;              HelpWndwNum:=4;
  195.   end;
  196.   with SubMenu[2] do
  197.   begin
  198.     MenuMode:=MultipleChoice;
  199.     Line[1]:='FM Stereo';       Selected[1]:=true;
  200.     Line[2]:='AM Radio';        Selected[2]:=true;
  201.     Line[3]:='Cassette';
  202.     Line[4]:='Compact Disc';
  203.     MenuLines:=4;               DefaultLine:=4;
  204.     MsgLineNum:=4;              HelpWndwNum:=5;
  205.   end;
  206.   with SubMenu[3] do
  207.   begin
  208.     MenuMode:=ExecChoice;
  209.     Line[1]:='1 process';
  210.     Line[2]:='2 process and pop';
  211.     Line[3]:='3 pop and process';
  212.     Line[4]:='4 Pop, process, pull';
  213.     MenuLines:=4;               DefaultLine:=3;
  214.     MsgLineNum:=4;              HelpWndwNum:=3;
  215.   end;
  216.    { Here's a SubSubMenu: }
  217.   with SubMenu[4] do
  218.   begin
  219.     MenuMode:=SingleChoice;     SingleSel:=2;
  220.     Line[1]:='Michlein';
  221.     Line[2]:='General';
  222.     Line[3]:='Firestone';
  223.     Line[4]:='Perrelli';
  224.     Line[5]:='WeatherGuard';
  225.     MenuLines:=5;               DefaultLine:=3;
  226.     MsgLineNum:=4;              HelpWndwNum:=4;
  227.   end;
  228.  
  229.   { ----------------- Set up your Data Windows here: --------------------- }
  230.   { ErrorMsgNum is only needed for numeric windows. }
  231.   AutoNumLock:=true;          { Turns NumLock on with numeric window }
  232.   with DataWndw[1] do
  233.   begin
  234.     Line[1]:='Currently:';
  235.     Line[2]:='Enter byte:';
  236.     TypeOfData:=Bytes;
  237.     Field:=3;
  238.     MsgLineNum:=5;              HelpWndwNum:=6;             ErrorMsgNum:=1;
  239.   end;
  240.   with DataWndw[2] do
  241.   begin
  242.     Line[1]:='Currently:';
  243.     Line[2]:='Enter integer:';
  244.     TypeOfData:=Integers;
  245.     Field:=6;
  246.     MsgLineNum:=5;              HelpWndwNum:=6;             ErrorMsgNum:=1;
  247.   end;
  248.   with DataWndw[3] do
  249.   begin
  250.     Line[1]:='Currently:';
  251.     Line[2]:='Enter real:';
  252.     TypeOfData:=Reals;
  253.     Field:=17;
  254.     Decimals:=08;              { Neg value uses R:F.  Pos value - R:F:D. }
  255.     MsgLineNum:=5;              HelpWndwNum:=6;             ErrorMsgNum:=1;
  256.   end;
  257.   with DataWndw[4] do
  258.   begin
  259.     Line[1]:='Currently:';
  260.     Line[2]:='Enter char:';
  261.     TypeOfData:=Chars;
  262.     Field:=1;
  263.     MsgLineNum:=6;              HelpWndwNum:=7;
  264.   end;
  265.   with DataWndw[5] do
  266.   begin
  267.     Line[1]:='Currently:';
  268.     Line[2]:='Enter string:';
  269.     TypeOfData:=Strings;
  270.     Field:=25;                 { If field is too large to fit, program
  271.                                  centers it on screen. You can override. }
  272.     MsgLineNum:=6;              HelpWndwNum:=7;
  273.   end;
  274.   with DataWndw[6] do
  275.   begin
  276.     Line[1]:='Currently:';
  277.     Line[2]:='Enter name:';
  278.     TypeOfData:=Strings;
  279.     Field:=12;
  280.     MsgLineNum:=6;              HelpWndwNum:=7;
  281.   end;
  282.  
  283.   { ----------------------- Set up your Help Windows here: ------------------ }
  284.   { HelpWndw[1] is reserved for the workspace. }
  285.   { HelpWndw[2] is reserved for the top menu. }
  286.   with HelpWndw[1] do
  287.   begin
  288.     FirstLine:=1; LastLine:=10;
  289.     LinesToShow:=10;
  290.     MsgLineNum:=7
  291.   end;
  292.   with HelpWndw[2] do
  293.   begin
  294.     FirstLine:=25; LastLine:=26;
  295.     LinesToShow:=2;
  296.     MsgLineNum:=7
  297.   end;
  298.   with HelpWndw[3] do
  299.   begin
  300.     FirstLine:=11; LastLine:=13;
  301.     LinesToShow:=3;
  302.     MsgLineNum:=7
  303.   end;
  304.   with HelpWndw[4] do
  305.   begin
  306.     FirstLine:=14; LastLine:=16;
  307.     LinesToShow:=3;
  308.     MsgLineNum:=7
  309.   end;
  310.   with HelpWndw[5] do
  311.   begin
  312.     FirstLine:=17; LastLine:=19;
  313.     LinesToShow:=3;
  314.     MsgLineNum:=7
  315.   end;
  316.   with HelpWndw[6] do
  317.   begin
  318.     FirstLine:=20; LastLine:=22;
  319.     LinesToShow:=3;
  320.     MsgLineNum:=7
  321.   end;
  322.   with HelpWndw[7] do
  323.   begin
  324.     FirstLine:=23; LastLine:=24;
  325.     LinesToShow:=2;
  326.     MsgLineNum:=7
  327.   end;
  328.  
  329.   { ------------------- Set up your Help Lines here: ------------------------ }
  330.   HelpLine[1]:='              WELCOME TO PULL11.ARC';
  331.   HelpLine[2]:='';
  332.   HelpLine[3]:='These files will enable you to do fully developed';
  333.   HelpLine[4]:='Pull-Down menus along with:';
  334.   HelpLine[5]:='   - Workspace window';
  335.   HelpLine[6]:='   - Top, Main, and Multiple Submenus';
  336.   HelpLine[7]:='   - Data entry windows';
  337.   HelpLine[8]:='   - Help windows for each of the above';
  338.   HelpLine[9]:='   - Pull/Pop remebers last menu';
  339.   HelpLine[10]:='   - Message lines for prompts and processing';
  340.   HelpLine[11]:='         This is an Execute Choice Menu.';
  341.   HelpLine[12]:='         Notice that there are no flags.';
  342.   HelpLine[13]:='   "'#240'" means linked SubMenu; "'#250'" - DataWndw.';
  343.   HelpLine[14]:='          This is a Single Choice Menu.';
  344.   HelpLine[15]:='          Notice there''s only one flag.';
  345.   HelpLine[16]:='   "'#240'" means linked SubMenu; "'#250'" - DataWndw.';
  346.   HelpLine[17]:='         This is a Multiple Choice Menu.';
  347.   HelpLine[18]:='              Notice several flags.';
  348.   HelpLine[19]:='   "'#240'" means linked SubMenu; "'#250'" - DataWndw.';
  349.   HelpLine[20]:='This is a numeric scratch pad.  Enter data between';
  350.   HelpLine[21]:='the symbols.  Only certain characters are valid.';
  351.   HelpLine[22]:='BS is active.  To clear, ESC+CR. Try to mess up!.';
  352.   HelpLine[23]:='This is a text scratch pad.  Enter data between';
  353.   HelpLine[24]:='the symbols shown.  DEL+CR allows a null entry.';
  354.   HelpLine[25]:='Move cursor and press return OR type a command';
  355.   HelpLine[26]:='letter.  ESC to return to the workspace.';
  356.  
  357.   { ------------------ Set up your Message Lines here: ---------------------- }
  358.   { Concatonations here fit the lines on 80 col printer. }
  359.   { MsgLine[1] is reserved as the workspace message line. }
  360.   { MsgLine[2] is reserved as the top menu  message line. }
  361.   MsgLine[1]:=' F1-help  F2-pull  ESC-pull    /-cmd    '+
  362.               '                                        ';
  363.   MsgLine[2]:=' F1-help  F2-pop   ESC-return  '#224'-cmd    '+
  364.               '        '^Z^[' hilight            CR-select ';
  365.   MsgLine[3]:=' F1-help  F2-pop   ESC-return  '#224'-cmd    '+
  366.               '        '^Z^[' menus  '^X^Y'-hilight  CR-select ';
  367.   MsgLine[4]:=' F1-help  F2-pop   ESC-return  '#224'-cmd    '+
  368.               '                  '^X^Y'-hilight  CR-select ';
  369.   MsgLine[5]:=' F1-help  F2-pop   ESC-return           '+
  370.               '                              CR-enter  ';
  371.   MsgLine[6]:=' F1-help  F2-pop   ESC-return           '+
  372.               '                    DEL-null  CR-enter  ';
  373.   MsgLine[7]:=' F1-return         ESC-return           '+
  374.               '                                        ';
  375.   MsgLine[8]:=' Processing ...                         '+
  376.               '                                        ';
  377.  
  378.   { ------------------ Set up your Message Lines here: ---------------------- }
  379.   ErrMsgLine[1]:=' Invalid entry.    ESC-acknowledge';
  380.   ErrMsgLine[2]:=' $2500 limit       ESC-acknowledge';
  381.  
  382. end;  { procedure GetUserPullStats }
  383.  
  384. { *****************************    STEP 3   ********************************* }
  385. { You can override the automatic Colors, Sizes, and Locations here. }
  386. procedure GetOverrideStats;
  387. begin
  388. { DataWndw[5].RowAlt:=10;
  389.   DataWndw[5].ColAlt:=3 }
  390.   SubMenu[4].Wattr:= Attr(lightgreen,black);
  391.   SubMenu[4].Battr:= Attr(green,black);
  392.   if Vmode<>7 then SubMenu[4].HiAttr:=Attr(black,green);
  393.   with MainMenu[1] do
  394.   begin
  395.     delete (CmdLtrs,2,3);             { This changes the command letters on }
  396.     insert ('AIO',CmdLtrs,2);         { Main Menu 1 to other than 1st letters }
  397.   end;
  398. end;
  399.  
  400. { *****************************    STEP 4   ********************************* }
  401. { Your normal variables and procedures now go here: }
  402. { Here are some sample user variables. }
  403. var
  404.   aByte,Seats,years:   byte;
  405.   aInteger,PriceLimit: integer;
  406.   aReal:       real;
  407.   aChar:       char;
  408.   aString:     MaxString;
  409.   FileName:    string[12];
  410.   PopAndProcess:                 boolean;
  411.   OldMPulled,OldSPulled,OldHiLt: byte;
  412.  
  413. { Place your variables names here to interface with the menus.
  414.   MPulled is the Main Menu pulled and SPulled is the Sub Menu pulled.  HiLt
  415.   is the selection on that menu that called for the DataWndw.  I don't like
  416.   the method I chose here but it works. }
  417. { Careful! -- there's NO type checking here.  You MUST be certain case
  418.   statement, DataWndw, and TypeOfData all match. }
  419. procedure DataTransfer;   { (VAR DataPad: DataPadRec; HiLt: byte;
  420.                              VAR ErrMsg: integer); }
  421.   procedure Transfer (VAR UserVariable);
  422.   var Size:      integer;
  423.       UserByte1: byte absolute UserVariable;
  424.   begin
  425.     with DataPad do
  426.     begin
  427.       case TypeOfData of
  428.         Bytes,Chars: Size:=1;
  429.         Integers:    Size:=2;
  430.         Reals:       Size:=sizeof(R);
  431.         Strings:     if Store then
  432.                           Size:=1+length(S)
  433.                      else Size:=1+UserByte1;
  434.       end;
  435.       if Store then
  436.            Move (B,UserByte1,Size)
  437.       else Move (UserByte1,B,Size);
  438.     end
  439.   end;  { procedure }
  440. begin
  441.   with DataPad do
  442.   begin
  443.     if SPulled=0 then   { SPulled=0 when a Main Menu only is pulled. }
  444.       case MPulled of
  445.          1: case HiLt of
  446.               2,7: Transfer (FileName);
  447.               5:;
  448.             end;
  449.          3: case HiLt of
  450.               1..2:;
  451.               3: Transfer (Seats);
  452.             end;
  453.          4: case HiLt of
  454.               1: Transfer (aByte);
  455.               2: Transfer (aInteger);
  456.               3: Transfer (aReal);
  457.               4: Transfer (aChar);
  458.               5: Transfer (aString);
  459.             end;
  460.          5: case HiLt of
  461.                   { The following line shows how to place limits on data. }
  462.               7: if Store and (I>2500) then ErrMsg:=2
  463.                  else Transfer (PriceLimit);
  464.             end;
  465.          7: case HiLt of
  466.               7: Transfer (Years);
  467.             end;
  468.       end
  469.     else
  470.       case SPulled of
  471.         1: case HiLt of
  472.              1:;
  473.            end;
  474.         3: case HiLt of
  475.              1:;
  476.            end;
  477.       end  { case }
  478.   end  { with }
  479. end;
  480.  
  481. procedure DummyProcess;
  482. begin
  483.   Delay (1000);
  484. end;
  485.  
  486. { Place your procedure names here to interface with the ExecChoice menus.
  487.   MPulled is the Main Menu pulled and SPulled is the Sub Menu pulled.  HiLt
  488.   is the selection on that menu. }
  489. procedure Process;        { (MPulled,SPulled,HiLt: byte) }
  490. {}function Popped: boolean;
  491.   begin
  492.     if Pop then
  493.       begin
  494.         Popped:=true;
  495.         Pop:=false
  496.       end
  497.     else
  498.       begin
  499.         OldMPulled:=MPulled;
  500.         OldSPulled:=SPulled;
  501.         OldHiLt   :=HiLt;
  502.         Popped:=false;
  503.         Pop:=true;
  504.         PopAndProcess:=true
  505.       end;
  506. {}end;
  507. begin
  508.   ShowMsg (8);
  509.   if SPulled=0 then   { SPulled=0 when a Main Menu only is pulled. }
  510.     begin
  511.       case MPulled of
  512.          1: case HiLt of
  513.               1..4,6..8: DummyProcess;
  514.               5:;
  515.             end;
  516.          7: case HiLt of
  517.               1..5,7: DummyProcess;
  518.               6:;
  519.             end;
  520.          8: case HiLt of
  521.               1:;
  522.               2: begin
  523.                    Pop:=true;
  524.                    Quit:=true
  525.                  end;
  526.             end;
  527.       end;
  528.       if not(Pop or PopAndProcess) then ShowMsg (MainMenu[MPulled].MsgLineNum)
  529.     end
  530.   else
  531.     begin
  532.       case SPulled of
  533.         3: case HiLt of
  534.              1: DummyProcess;
  535.                  { The following line is how you process first and then pop
  536.                    the menu. }
  537.              2: begin
  538.                   DummyProcess;
  539.                   Pop:=true
  540.                 end;
  541.                  { The following line is how you pop the menus first and
  542.                    then process. }
  543.              3: if Popped then DummyProcess;
  544.                  { The following lines is how you pop the menus first,
  545.                    process, and then pull the same menu(s) again which is good
  546.                    for updating the screen. }
  547.              4: begin
  548.                   if Popped then DummyProcess;
  549.                   Pull:=true
  550.                 end;
  551.            end;
  552.       end;
  553.       if not(Pop or PopAndProcess) then ShowMsg (SubMenu[SPulled].MsgLineNum)
  554.     end
  555. end;
  556.  
  557. procedure DisplayScreen;
  558. var ColL,ColR: byte;
  559. begin
  560.   Qwrite (1,1,Attr(lightgray,black),'PULLDEMO v1.1             Multi-level Pu'+
  561.                                     'll-down menus        (c) 1987  J H LeMay');
  562.   QwriteV (TopMenuRow,1,TopMenuAttr,TopMenuStr);
  563.   MakeWindow (3,1,CRTrows-3,CRTcols,Attr(white,blue),Attr(lightgray,black),
  564.               DoubleBrdr);
  565.   with WndwStat[LI] do
  566.   begin
  567.     ColL:=WScol; ColR:=WScol+WScols-1;
  568.     QwriteC ( 9,ColL,ColR,-1,'PULL11.INC - MULTI-LEVEL PULLDOWN MENUS');
  569.     QwriteC (11,ColL,ColR,-1,'Use F1 everywhere for some descriptions.');
  570.     QwriteC (12,ColL,ColR,-1,'Use ''Quit'' to exit demo program.');
  571.     QwriteC (13,ColL,ColR,-1,'Be sure to try a CR at "'#240'" marked lines.');
  572.     QwriteC (14,ColL,ColR,-1,'Also try all the EnterData lines.');
  573.     QwriteC (16,ColL,ColR,-1,'This is the normal workspace window.');
  574.     GotoRC (WSrow+19,WScol+38)
  575.   end;
  576.   ShowMsg (1)
  577. end;
  578.  
  579. { *****************************    STEP 5   ********************************* }
  580. { It's all yours from here: }
  581. begin
  582.   InitPull;                   { <<-- Be sure you do this!! }
  583.   DisplayScreen;
  584.  
  585.     Seats:=4;
  586.     aByte:= 129;
  587.     aInteger:=-31456;
  588.     aReal:=-24.34565E06;
  589.     aChar:='q';
  590.     aString:='This is a string';
  591.     FileName:='testfile.txt';
  592.     Years:=30;
  593.     PriceLimit:=2000;
  594.  
  595.   repeat
  596.     if not Pull then ReadKB (ExtKey,Ch)
  597.     else
  598.       begin
  599.         Ch:=^[;
  600.         ExtKey:=false
  601.       end;
  602.     PopAndProcess:=false;
  603.     if ExtKey then
  604.       case Ch of
  605.         #59: PullHelpWndw (1,1,'Workspace Window');
  606.         #60: begin
  607.                Ch:=^[;
  608.                GoToMenus
  609.              end;
  610.       end
  611.     else
  612.       begin
  613.         if Ch in [^[,'/'] then
  614.              GoToMenus
  615.         else write (Ch)                  { <<--- Here's your input }
  616.       end;
  617.     if PopAndProcess then Process (OldMPulled,OldSPulled,OldHiLt);
  618.     if not Pull then ShowMsg (1);
  619.   until Quit;
  620.   RemoveWindow;
  621.   CursorChange (DOScursor,i);
  622.   ClrScr
  623. end.