home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / pascal / vdl020d.zip / VRESFILE.DOC < prev    next >
Text File  |  1993-04-14  |  19KB  |  821 lines

  1. {
  2.  ════════════════════════════════════════════════════════════════════════════
  3.  
  4.  Visionix Resource File (VRESFILE)
  5.  Copyright 1991,92,93 Visionix
  6.  ALL RIGHTS RESERVED
  7.  
  8.  File text retrieving library.  This unit provides the ability to use an
  9.  external text file for all text.  This is so that programs being supplied
  10.  to non-English countries may modify the text to their native language.
  11.  Also, this provides a method of automating the creation of basic menus -
  12.  all data provided in the .MNU file.
  13.  
  14.  ────────────────────────────────────────────────────────────────────────────
  15.  
  16.  Revision history in reverse chronological order:
  17.  
  18.  Initials  Date      Comment
  19.  ────────  ────────  ────────────────────────────────────────────────────────
  20.  
  21.  lpg       03/15/93  Added Source Documentation
  22.  
  23.  jrt       04/08/93  Cleaned up code to use VGEN functions;
  24.                      (GetParamName, etc)
  25.                      Added code to do indexing.  Don't ask about
  26.                      the indexing algorithym.
  27.  
  28.  mep       02/11/93  Cleaned up code for beta release
  29.  
  30.  jrt       11/21/92  Sync with beta 0.08
  31.  
  32.  jrt       09/29/92  Converted function names to new format;
  33.                      Added VRF_GetInt; cleaned up, etc. etc.
  34.  
  35.  jrt       09/01/92  First logged revision.
  36.  ════════════════════════════════════════════════════════════════════════════
  37. }
  38.  
  39. (*-
  40.  
  41. ALL EXAMPLES ASSUME A RESOURCE FILE AS FOLLOWS...
  42.  
  43. File Name: PROGRAM.MNU
  44.  
  45. ---FILE BEGIN---
  46.  
  47. MENU_BEGIN "Sector Menu"
  48.   "Read Sector      "
  49.   "Write Sector     "
  50.   "View/Edit Sector "
  51.   KEYS = "RWV"
  52.   ROWS = 5
  53.   COLS = 1
  54.   FORE = White
  55.   BACK = Cyan
  56.   MESG = "Select Action|<ESC>=Abort"
  57. MENU_END
  58.  
  59. DIALOG_BEGIN "Out of Range"
  60.   "[Sorry but that Entry is out of Range.|Please Try Again.]"
  61.   TYPE = "[1]"
  62.   OPTS = "OK"
  63. DIALOG_END
  64.  
  65. DIALOG_BEGIN "AbortRetry Dialog"
  66.   "[Error in Operation.||Please Select Action.]"
  67.   TYPE = "[1]"
  68.   OPTS = "[Abort|Retry|Ignore|Fail]"
  69.   KEYS = "ARIF"
  70. DIALOG_END
  71.  
  72. TEXT "Program Name" = "Sector Edit Program, Ver 1.0"
  73.  
  74. TEXT "DevName"      = "Device Name   :"
  75. TEXT "TotBlks"      = "Total Sectors :"
  76.  
  77. TEXT "BPS"          = "Bytes Per Sector    :"
  78. TEXT "SPC"          = "Sectors Per Cluster :"
  79. TEXT "CPD"          = "Clusters Per Drive  :"
  80.  
  81. TEXT "EnterBlk"     = "Enter Sector to Load"
  82.  
  83. TEXT "PressKey"     = "Press any key to Continue"
  84.  
  85. TEXT "Reading"      = "Reading Sector.  One Moment..."
  86. TEXT "Writing"      = "Writing Sector.  One Moment..."
  87. TEXT "View/Edit"    = "Use Arrow Keys to Scroll|<ESC> to Quit"
  88. TEXT "NoMessage"    = " "
  89. TEXT "CurrInfo"     = "Drive : %D     Current Sector : %S"
  90.  
  91. TEXT "GB"           = "Thousand Bytes"
  92. TEXT "KB"           = "KiloByte"
  93. TEXT "MB"           = "MegaByte"
  94.  
  95. TEXT "Block"        = "Sector"
  96.  
  97. INTEGER "One"       = 1
  98. INTEGER "Ten"       = 10
  99. INTEGER "Hundred"   = 100
  100. INTEGER "Thousand"  = 1000
  101.  
  102. INTEGER "Byte"      = 256
  103.  
  104. INTEGER "SectSize"  = 256
  105. INTEGER "BlkSize"   = 512
  106. INTEGER "ClustSize" = 2048
  107. INTEGER "DrvSize"   = 20
  108.  
  109. INTEGER "Kilo"      = 1024
  110. INTEGER "Meg"       = 1048576
  111.  
  112. COLOR "Black"       = 0
  113. COLOR "Blue"        = 1
  114. COLOR "Green"       = 2
  115. COLOR "Cyan"        = 3
  116. COLOR "Red"         = 4
  117. COLOR "Magenta"     = 5
  118. COLOR "Brown"       = 6
  119. COLOR "Lt Gray"     = 7
  120. COLOR "Dk Gray"     = 8
  121. COLOR "Lt Blue"     = 9
  122. COLOR "Lt Green"    = 10
  123. COLOR "Lt Cyan"     = 11
  124. COLOR "Lt Red"      = 12
  125. COLOR "Lt Magenta"  = 13
  126. COLOR "Yellow"      = 14
  127. COLOR "White"       = 15
  128.  
  129. ---FILE END---
  130.  
  131. -*)
  132.  
  133. Unit VResFile;
  134.  
  135.  
  136. Uses
  137.  
  138.   VTypes,
  139.   VGen,
  140.   VDOSHigh,
  141.   VWinlow;
  142.  
  143. {────────────────────────────────────────────────────────────────────────────}
  144.  
  145. Procedure VRF_New(                     FName     : ST80      );
  146.  
  147. Procedure VRF_GetMenu(                 ID         : ST80;
  148.                                    Var Menu       : TMenu;
  149.                                    Var Keys       : ST80;
  150.                                    Var NumChoices : INTEGER;
  151.                                    Var Rows       : INTEGER;
  152.                                    Var Cols       : INTEGER;
  153.                                    Var FC         : INTEGER;
  154.                                    Var BC         : INTEGER;
  155.                                    Var Message    : ST80     );
  156.  
  157. Function  VRF_DoMenu(                  Opts      : ST80;
  158.                                        ID        : ST80;
  159.                                        X         : INTEGER;
  160.                                        Y         : INTEGER;
  161.                                        FC        : INTEGER;
  162.                                        BC        : INTEGER   ) : INTEGER;
  163.  
  164. Function  VRF_DoMenu_Kill(             Opts      : ST80;
  165.                                        ID        : ST80;
  166.                                        X         : INTEGER;
  167.                                        Y         : INTEGER;
  168.                                        FC        : INTEGER;
  169.                                        BC        : INTEGER   ) : INTEGER;
  170.  
  171. Function  VRF_GetDialog(               ID        : ST80      ) : STRING;
  172.  
  173. Function  VRF_GetText(                 ID        : ST80      ) : STRING;
  174.  
  175. Function  VRF_GetInt(                  ID        : ST80      ) : LONGINT;
  176.  
  177. Function  VRF_GetColorNum(             ID        : ST80      ) : BYTE;
  178.  
  179. Procedure VRF_Dispose;
  180.  
  181. {────────────────────────────────────────────────────────────────────────────}
  182.  
  183.  
  184. ──────────────────────────────────────────────────────────────────────────────
  185.  
  186.  
  187. [FUNCTION]
  188.  
  189. Procedure FTError(                     S         : ST80      );
  190.  
  191. [PARAMETERS]
  192.  
  193. S           Resource File Error Message
  194.  
  195. [RETURNS]
  196.  
  197. (None)
  198.  
  199. [DESCRIPTION]
  200.  
  201. Takes the Provided Resource File Error Message and Displays it in the top
  202. left of the Screen.  Then Shuts down the Program.
  203.  
  204. [SEE-ALSO]
  205.  
  206. [EXAMPLE]
  207.  
  208. BEGIN
  209.  
  210.   WriteLn( 'About to Call FTError...' );
  211.  
  212.   FTError( 'Could not find Menu Item' );  { HALTS HERE }
  213.  
  214.   WriteLn( 'Should have never gotten here!' );
  215.  
  216. END;
  217.  
  218.  
  219. ──────────────────────────────────────────────────────────────────────────────
  220.  
  221.  
  222. [FUNCTION]
  223.  
  224. Function GetStartLine(                 ID        : ST80      ) : INTEGER;
  225.  
  226. [PARAMETERS]
  227.  
  228. ID          Resource File Item ID Name to search for
  229.  
  230. [RETURNS]
  231.  
  232. The Indexed Line Number which this Item ID Name represents.
  233.  
  234. [DESCRIPTION]
  235.  
  236. Takes the Item ID Name and searches the Pre-Loaded Resource File Data
  237. until it either finds this item or fails to.  If it is found then the
  238. Line Index Number is returned.
  239.  
  240. If not, then this is an Error Condition though nothing happens.
  241.  
  242. [SEE-ALSO]
  243.  
  244. [EXAMPLE]
  245.  
  246. {NOTE: All Examples use Above Demo Resource File}
  247.  
  248. BEGIN
  249.  
  250.   WriteLn( 'Found at Line ',GetStartLine( 'Blue' ) );
  251.  
  252.   { Should have Found this ID on Line x of the example Resource File }
  253.  
  254. END;
  255.  
  256.  
  257. ──────────────────────────────────────────────────────────────────────────────
  258.  
  259.  
  260. [FUNCTION]
  261.  
  262. Procedure VRF_New(                     FName     : ST80      );
  263.  
  264. [PARAMETERS]
  265.  
  266. FName       Resource File to Load
  267.  
  268. [RETURNS]
  269.  
  270. (None)
  271.  
  272. [DESCRIPTION]
  273.  
  274. Reads the Resource File Data from the given File Name and Loads all
  275. the Data in RAM for Quick Access.
  276.  
  277. [SEE-ALSO]
  278.  
  279. [EXAMPLE]
  280.  
  281. {NOTE: All Examples use Above Demo Resource File}
  282.  
  283. Uses VGen,VWinHigh,VResFile;
  284.  
  285. VAR
  286.   I : INTEGER;
  287.  
  288. BEGIN
  289.  
  290.   WOpen( '▒',BLACK,BLUE,'CLOCK' );
  291.   VRF_New( 'PROGRAM.MNU' );
  292.  
  293.   I := WGemDialogBox( VRF_GetDialog( 'AbortRetry' ) );
  294.  
  295.   WMessage( 'Selection : ' + IntToStr(i) + '|' + VRF_GetText('PressKey'),
  296.             WHITE,CYAN );
  297.   While NOT WKeyPressed Do;
  298.  
  299.   WDispose;
  300.   WClose;
  301.  
  302. END;
  303.  
  304.  
  305. ──────────────────────────────────────────────────────────────────────────────
  306.  
  307.  
  308. [FUNCTION]
  309.  
  310. Procedure VRF_GetMenu(                 ID         : ST80;
  311.                                    Var Menu       : TMenu;
  312.                                    Var Keys       : ST80;
  313.                                    Var NumChoices : INTEGER;
  314.                                    Var Rows       : INTEGER;
  315.                                    Var Cols       : INTEGER;
  316.                                    Var FC         : INTEGER;
  317.                                    Var BC         : INTEGER;
  318.                                    Var Message    : ST80     );
  319.  
  320. [PARAMETERS]
  321.  
  322. ID          Resource File Menu ID Name
  323. Menu        VAR Returned Menu Data
  324. Keys        VAR Returned Active Menu Keys
  325. NumChoices  VAR Returned Number of Menu Choices
  326. Rows        VAR Returned Number of Menu Rows
  327. Cols        VAR Returned Number of Menu Cols
  328. FC          VAR Returned Menu Foreground Color
  329. BC          VAR Returned Menu Background Color
  330. Message     VAR Returned Message Line associated with Menu
  331.  
  332. [RETURNS]
  333.  
  334. Function : None
  335. (VAR     : [Menu] Menu Data)
  336. (VAR     : [Keys] Active Menu Keys)
  337. (VAR     : [NumChoices] Number of Menu Choices)
  338. (VAR     : [Rows] Number of Menu Rows)
  339. (VAR     : [Cols] Number of Menu Cols)
  340. (VAR     : [FC] Menu Foreground Color)
  341. (VAR     : [BC] Menu Background Color)
  342. (VAR     : [Message] WMessage Line associated with Menu)
  343.  
  344. [DESCRIPTION]
  345.  
  346. Searches the Pre-Loaded Resource File Data for the Menu identified by the
  347. ID Name.  When this is found, loads and returns all the Menu Information
  348. associated with this.
  349.  
  350. [SEE-ALSO]
  351.  
  352. VFR_GetDialog
  353. VFR_GetText
  354. VFR_GetInt
  355. VRF_GetColorNumber
  356. VRF_DoMenu
  357. VRF_DoMenu_Kill
  358.  
  359. [EXAMPLE]
  360.  
  361. {NOTE: All Examples use Above Demo Resource File}
  362.  
  363. Uses VGen,VWinHigh,VResFile;
  364.  
  365. VAR
  366.   Menu      : TMenu;
  367.   Keys, Msg : ST80;
  368.   Num,
  369.   Rows,Cols,
  370.   FC,BC,
  371.   I,Start   : INTEGER;
  372.  
  373. BEGIN
  374.  
  375.   WOpen( '▒', BLACK,BLUE, 'CLOCK' );
  376.   VRF_New( 'Program.mnu' );
  377.  
  378.   VRF_Menu( 'Sector Menu', Menu, Keys, Num, Rows, Cols, FC,BC, Msg );
  379.  
  380.   WMessage( Msg, WHITE,CYAN );
  381.   Start := 1;
  382.   I     := WAutoMenu_Kill( Addr( Menu ),
  383.                            Num,
  384.                            Cols,
  385.                            Rows,
  386.                            Keys,
  387.                            X, Y,
  388.                            FC, BC,
  389.                            FC, BC,
  390.                            'Sector Menu',
  391.                            Start );
  392.  
  393.   WMessage( 'Selection : '+IntToStr( i )+'|Press any Key to Quit',
  394.             WHITE,CYAN );
  395.   While NOT WKeyPressed Do;
  396.  
  397.   VRF_Dispose;
  398.   WClose;
  399.  
  400. END;
  401.  
  402.  
  403. ──────────────────────────────────────────────────────────────────────────────
  404.  
  405.  
  406. [FUNCTION]
  407.  
  408. Function  VRF_GetDialog(               ID        : ST80      ) : STRING;
  409.  
  410. [PARAMETERS]
  411.  
  412. ID          Resource File Dialog ID Name
  413.  
  414. [RETURNS]
  415.  
  416. Dialog Box String associated with ID Name
  417.  
  418. [DESCRIPTION]
  419.  
  420. Searches the Pre-Loaded Resource File Data for the Dialog identified by
  421. the ID Name.  When this is found, loads and returns the Dialog String
  422. information associated with this.
  423.  
  424. [SEE-ALSO]
  425.  
  426. VFR_GetMenu
  427. VFR_GetText
  428. VFR_GetInt
  429. VRF_GetColorNumber
  430.  
  431. [EXAMPLE]
  432.  
  433. {NOTE: All Examples use Above Demo Resource File}
  434.  
  435. Uses VGen,VWinHigh,VResFile;
  436.  
  437. VAR
  438.   S : STRING;
  439.   I : INTEGER;
  440.  
  441. BEGIN
  442.  
  443.   WOpen( '▒',BLACK,BLUE,'CLOCK' );
  444.   VRF_New( 'PROGRAM.MNU' );
  445.  
  446.   I := WGemDialogBox( VFR_GetDialog( 'AbortRetry' ) );
  447.  
  448.   WMessage( 'Selection : ',IntToStr(i)+'|Press any key to Quit',
  449.             WHITE,CYAN );
  450.   While NOT WKeyPressed Do;
  451.  
  452.   WDispose;
  453.   WClose;
  454.  
  455. END;
  456.  
  457.  
  458. ──────────────────────────────────────────────────────────────────────────────
  459.  
  460.  
  461. [FUNCTION]
  462.  
  463. Function  VRF_GetText(                 ID        : ST80      ) : STRING;
  464.  
  465. [PARAMETERS]
  466.  
  467. ID          File-Text Text ID Name
  468.  
  469. [RETURNS]
  470.  
  471. Text Associated with the Text ID Name
  472.  
  473. [DESCRIPTION]
  474.  
  475. Searches the Pre-Loaded File-Text Data for the Text identified by the
  476. ID Name.  When this is found, loads and returns the Text String
  477. information associated with this.
  478.  
  479. [SEE-ALSO]
  480.  
  481. VFR_GetMenu
  482. VFR_GetDialog
  483. VFR_GetInt
  484. VRF_GetColorNumber
  485.  
  486. [EXAMPLE]
  487.  
  488. {NOTE: All Examples use Above Demo Resource File}
  489.  
  490. Uses VWinHigh,VResFile;
  491.  
  492. VAR
  493.   BPS,
  494.   SPC,
  495.   CPD : LONGINT;
  496.  
  497. BEGIN
  498.  
  499.   WOpen( '▒', BLACK,BLUE, 'CLOCK' );
  500.   VRF_New( 'PROGRAM.MNU' );
  501.  
  502.   WPrgName( VRF_Text( 'ProgName' ) );
  503.   WNew( 10, 5, 40, 15, WHITE,CYAN,WHITE,CYAN, 'Drive Info' )
  504.  
  505.   BPS := VRF_GetInt('BlkSize') DIV VRF_GetInt('SectSize')
  506.   SPC := VRF_GetInt('ClustSize') DIV BPS;
  507.   CPD := VRF_GetInt('DrvSize') * VRF_GetInt('MB') DIV SPC;
  508.  
  509.   WriteLn ( VRF_Text( 'BPS' ), BPS );
  510.   WriteLn ( VRF_Text( 'SPC' ), SPC );
  511.   WriteLn ( VRF_Text( 'CPD' ), CPD );
  512.  
  513.   WMessage( VRF_GetText( 'PressKey' ), WHITE,CYAN );
  514.  
  515.   While NOT WKeyPressed Do;
  516.  
  517.   WDispose( 'Drive Info' );
  518.   VRF_Dispose;
  519.   WClose;
  520.  
  521. END;
  522.  
  523.  
  524. ──────────────────────────────────────────────────────────────────────────────
  525.  
  526.  
  527. [FUNCTION]
  528.  
  529. Function  VRF_GetInt(                  ID        : ST80      ) : LONGINT;
  530.  
  531. [PARAMETERS]
  532.  
  533. ID          Resource File Integer ID Name
  534.  
  535. [RETURNS]
  536.  
  537. Integer Value associate with the Integer ID Name
  538.  
  539. [DESCRIPTION]
  540.  
  541. Searches the Pre-Loaded Resource File Data for the Integer Value identified
  542. by the ID Name.  When this is found, loads and returns the Integer Value
  543. information associated with this.
  544.  
  545. [SEE-ALSO]
  546.  
  547. VFR_GetMenu
  548. VFR_GetDialog
  549. VFR_GetText
  550. VFR_GetColorNumber
  551.  
  552. [EXAMPLE]
  553.  
  554. {NOTE: All Examples use Above Demo Resource File}
  555.  
  556. Uses VWinHigh,VResFile;
  557.  
  558. VAR
  559.   BPS,
  560.   SPC,
  561.   CPD : LONGINT;
  562.  
  563. BEGIN
  564.  
  565.   WOpen( '▒', BLACK,BLUE, 'CLOCK' );
  566.   VRF_New( 'PROGRAM.MNU' );
  567.  
  568.   WPrgName( VRF_Text( 'ProgName' ) );
  569.   WNew( 10, 5, 40, 15, WHITE,CYAN,WHITE,CYAN, 'Drive Info' )
  570.  
  571.   BPS := VRF_GetInt('BlkSize') DIV VRF_GetInt('SectSize')
  572.   SPC := VRF_GetInt('ClustSize') DIV BPS;
  573.   CPD := VRF_GetInt('DrvSize') * VRF_GetInt('MB') DIV SPC;
  574.  
  575.   WriteLn ( VRF_Text( 'BPS' ), BPS );
  576.   WriteLn ( VRF_Text( 'SPC' ), SPC );
  577.   WriteLn ( VRF_Text( 'CPD' ), CPD );
  578.   WriteLn;
  579.   WriteLn( 'KiloByte = ', VRF_GetInt( 'KB' ) );
  580.   WriteLn( 'GigaByte = ', VRF_GetInt( 'GB' ) );
  581.  
  582.   WMessage( VRF_GetText( 'PressKey' ), WHITE,CYAN );
  583.   While NOT WKeyPressed Do;
  584.  
  585.   WDispose( 'Drive Info' );
  586.   VRF_Dispose;
  587.   WClose;
  588.  
  589. END;
  590.  
  591.  
  592. ──────────────────────────────────────────────────────────────────────────────
  593.  
  594.  
  595. [FUNCTION]
  596.  
  597. Function  VRF_GetColorNum(             ID        : ST80      ) : BYTE;
  598.  
  599. [PARAMETERS]
  600.  
  601. ID          Resource File Color ID Name
  602.  
  603. [RETURNS]
  604.  
  605. Color Value associate with the Color ID Name
  606.  
  607. [DESCRIPTION]
  608.  
  609. Searches the Pre-Loaded Resource File Data for the Color Value identified
  610. by the ID Name.  When this is found, loads and returns the Color Value
  611. information associated with this.
  612.  
  613. [SEE-ALSO]
  614.  
  615. VFR_GetMenu
  616. VFR_GetDialog
  617. VFR_GetText
  618. VFR_GetInt
  619.  
  620. [EXAMPLE]
  621.  
  622. {NOTE: All Examples use Above Demo Resource File}
  623.  
  624. BEGIN
  625.  
  626.   VRF_New( 'Program.mnu' );
  627.  
  628.   WriteLn( 'Red   = ', VRF_GetColorNum( 'Red' ) );
  629.   WriteLn( 'Blue  = ', VRF_GetColorNum( 'Green' ) );
  630.   WriteLn( 'Green = ', VRF_GetColorNum( 'Blue' ) );
  631.  
  632.   WriteLn( VRF_GetText( 'PressKey' ) );
  633.   While NOT WKeyPressed Do;
  634.  
  635.   VRF_Dispose;
  636.  
  637. END;
  638.  
  639.  
  640. ──────────────────────────────────────────────────────────────────────────────
  641.  
  642.  
  643. [FUNCTION]
  644.  
  645. Function VRF_DoMenu(                   Opts      : ST80;
  646.                                        ID        : ST80;
  647.                                        X         : INTEGER;
  648.                                        Y         : INTEGER;
  649.                                        FC        : INTEGER;
  650.                                        BC        : INTEGER    ) : INTEGER;
  651.  
  652. [PARAMETERS]
  653.  
  654. Opts        Menu Options
  655. ID          Resource File Menu ID Name (Also used as Window Name)
  656. X           Menu X Coordinate
  657. Y           Menu Y Coordinate
  658. FC          Overriding Foreground Color (-1 = Use data from File)
  659. BC          Overriding Background Color (-1 = Use data from File)
  660.  
  661. [RETURNS]
  662.  
  663. User Menu Item Selection
  664.  
  665. [DESCRIPTION]
  666.  
  667. Searches the Pre-Loaded Resource File Data for the Menu identified by
  668. the ID Name.  When this is found, loads and executes the Menu,
  669. returning the User Menu Selection.
  670.  
  671. This Function does not Remove the Created Menu Window from the Screen,
  672. which must be removed by the programmer manually.  The Window Name is
  673. the same as the Resource File Menu ID Name.  So be sure that those
  674. Names are what you would want displayed at the top of a Menu Window.
  675.  
  676. [SEE-ALSO]
  677.  
  678. VRF_GetMenu
  679. VRF_DoMenu_Kill
  680.  
  681. [EXAMPLE]
  682.  
  683. {NOTE: All Examples use Above Demo Resource File}
  684.  
  685. Uses VGen,VWinHigh,VResFile;
  686.  
  687. VAR
  688.   I : INTEGER;
  689.  
  690. BEGIN
  691.  
  692.   WOpen( '▒',BLACK,BLUE,'SHADOW' );
  693.   VRF_New( 'PROGRAM.MNU' );
  694.  
  695.   I := VRF_DoMenu( '', 'Menu Name', 20, 5, -1, -1 );
  696.  
  697.   WMessage( 'Selection : '+IntToStr(i)+'|'+VRF_GetText('PressKey'),
  698.             WHITE, CYAN );
  699.   While NOT WKeyPressed Do;
  700.  
  701.   WDispose( 'Menu Name' );
  702.   VRF_Dispose;
  703.   WClose;
  704.  
  705. END;
  706.  
  707.  
  708. ──────────────────────────────────────────────────────────────────────────────
  709.  
  710.  
  711. [FUNCTION]
  712.  
  713. Function VRF_DoMenu_Kill(              Opts      : ST80;
  714.                                        ID        : ST80;
  715.                                        X         : INTEGER;
  716.                                        Y         : INTEGER;
  717.                                        FC        : INTEGER;
  718.                                        BC        : INTEGER   ) : INTEGER;
  719.  
  720. [PARAMETERS]
  721.  
  722. Opts        Menu Options
  723. ID          Resource File Menu ID Name  (Also used as Window Name)
  724. X           Menu X Coordinate
  725. Y           Menu Y Coordinate
  726. FC          Overriding Foreground Color (-1 = Use data from File)
  727. BC          Overriding Background Color (-1 = Use data from File)
  728.  
  729. [RETURNS]
  730.  
  731. User Menu Item Selection
  732.  
  733. [DESCRIPTION]
  734.  
  735. Searches the Pre-Loaded Resource File Data for the Menu identified by
  736. the ID Name.  When this is found, loads and executes the Menu,
  737. returning the User Menu Selection.  Also removes the Created Menu
  738. Window from the Screen before returning.
  739.  
  740. [SEE-ALSO]
  741.  
  742. VRF_GetMenu
  743. VRF_DoMenu
  744.  
  745. [EXAMPLE]
  746.  
  747. {NOTE: All Examples use Above Demo Resource File}
  748.  
  749. Uses VGen,VWinHigh,VResFile;
  750.  
  751. VAR
  752.   I : INTEGER;
  753.  
  754. BEGIN
  755.  
  756.   WOpen( '▒',BLACK,BLUE,'SHADOW' );
  757.   VRF_New( 'PROGRAM.MNU' );
  758.  
  759.   I := VRF_DoMenu_Kill( '', 'Menu Name', 20, 5, -1, -1 );
  760.  
  761.   WMessage( 'Selection : '+IntToStr(i)+'|'+VRF_GetText('PressKey'),
  762.             WHITE, CYAN );
  763.   While NOT WKeyPressed Do;
  764.  
  765.   VRF_Dispose;
  766.   WClose;
  767.  
  768. END;
  769.  
  770.  
  771. ──────────────────────────────────────────────────────────────────────────────
  772.  
  773.  
  774. [FUNCTION]
  775.  
  776. Procedure VRF_Dispose;
  777.  
  778. [PARAMETERS]
  779.  
  780. (None)
  781.  
  782. [RETURNS]
  783.  
  784. (None)
  785.  
  786. [DESCRIPTION]
  787.  
  788. Deallocates all data Previously Loaded by the
  789. [SEE-ALSO]
  790.  
  791. VRF_New
  792.  
  793. [EXAMPLE]
  794.  
  795. {NOTE: All Examples use Above Demo Resource File}
  796.  
  797. Uses VGen,VWinHigh,VResFile;
  798.  
  799. VAR
  800.   S : STRING;
  801.   I : INTEGER;
  802.  
  803. BEGIN
  804.  
  805.   WOpen( '▒',BLACK,BLUE,'CLOCK' );
  806.   VRF_New( 'PROGRAM.MNU' );
  807.  
  808.   S := VFR_GetDialog( 'AbortRetry' );
  809.  
  810.   I := WGemDialogBox( S );
  811.  
  812.   WMessage( 'Selection : ',IntToStr(i)+'|Press any key to Quit',
  813.             WHITE,CYAN );
  814.   While NOT WKeyPressed Do;
  815.  
  816.   WDispose;
  817.   WClose;
  818.  
  819. END;
  820.  
  821.