home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / menu.src < prev    next >
Encoding:
Text File  |  1993-05-19  |  102.5 KB  |  2,962 lines

  1. //****************************************************************************
  2. // Copyright 1987-1992 Data Access Corporation, Miami FL, USA
  3. // All Rights reserved
  4. //
  5. //    Name: menu.src
  6. // Purpose: 1 menu-driven front-end to DataFlex 3.0
  7. //          2 sample code for developers
  8. // Creator: Theo van Dongeren
  9. //    Date: June 26, 1991
  10. // 
  11. //Modified: AJG
  12. //    Date: June 5, 1992
  13. // Purpose: Modifiy the Quit Application Method to Instead override the
  14. //          Exit_Application Message.  This needs to get forwarded to 
  15. //          windows.
  16. //
  17. //****************************************************************************
  18.  
  19. use ui
  20. use menu
  21. use help
  22.  
  23. // provide a name to the application
  24. set application_name to 'System'
  25.  
  26. // the module name will default to the name of this program,
  27. // but it can also be set manually:
  28. set module_name to 'Menu'
  29.  
  30. // open the menu file
  31. open menu
  32.  
  33.  
  34. // Define a string to contain the OS directory seperator and one for the
  35. // wildcard mask of the OS.
  36. String Dir_Separator Wild_Card_Mask
  37. Move ( SysConf( SYSCONF_DIR_SEPARATOR )) to Dir_Separator
  38. Move ( SysConf( SYSCONF_FILE_MASK ))     to Wild_Card_Mask
  39.  
  40.  
  41.  
  42. /main_title
  43. ________________________________________________________________________________
  44. /main_action_bar
  45.   ____  ___  ____                                                               
  46. /main_object
  47.                                                                                 
  48.                                                                                 
  49.                                                                                 
  50.                        ┌────────────────────────────────┐                       
  51.                        │ ______________________________ │                       
  52.                        │ ______________________________ │                       
  53.                        ├────────────────────────────────┤                       
  54.                        │ ______________________________ │                       
  55.                        │ ______________________________ │                       
  56.                        │ ______________________________ │                       
  57.                        │ ______________________________ │                       
  58.                        │ ______________________________ │                       
  59.                        │ ______________________________ │                       
  60.                        │ ______________________________ │                       
  61.                        │ ______________________________ │                       
  62.                        │ ______________________________ │                       
  63.                        └────────────────────────────────┘                       
  64.                                                                                 
  65.                                                                                 
  66.                  <_________________>  <___________>  <_______>                  
  67.                                                                                 
  68. /*
  69.  
  70. sub_page menu_head from main_object 1 2
  71. sub_page menu_body from main_object vertical 3 9
  72. sub_page menu_button from main_object horizontal 12 3
  73.  
  74. /file_pull_down
  75. ┌──────────────────┐
  76. │ ________________ │
  77. │ ________________ │
  78. │ ________________ │
  79. │ ________________ │
  80. │ ________________ │
  81. ├──────────────────┤
  82. │ ________________ │
  83. └──────────────────┘
  84. /run_pull_down
  85. ┌─────────────────────┐
  86. │ ___________________ │
  87. │ ___________________ │
  88. │ ___________________ │
  89. └─────────────────────┘
  90. /password
  91. ╔════════════════════════════════════╗
  92. ║ __________________________________ ║
  93. ║ __________________________________ ║
  94. ╚════════════════════════════════════╝
  95. /*
  96.  
  97. sub_page invalid_password from password 1
  98.  
  99. /question
  100. ╔══════════════════════════════════════════════════════╗
  101. ║ ____________________________________________________ ║
  102. ║ ____________________________________________________ ║
  103. ║                                                      ║
  104. ║ ____________________________________________________ ║
  105. ║                                                      ║
  106. ║          <_____>   <__________>  <_______>           ║
  107. ╚══════════════════════════════════════════════════════╝
  108. /*
  109.  
  110. sub_page question_text from question 1 2
  111. sub_page question_reply from question 3
  112. sub_page question_button from question horizontal 4 3
  113.  
  114. /run_stuff
  115. ╔════════════════════════════════════════════════════════════════════════╗
  116. ║________________________________________________________________________║
  117. ║                                                                        ║
  118. ║ System command: ______________________________________________________ ║
  119. ║                                                                        ║
  120. ║                   <_____>   <__________>  <_______>                    ║
  121. ╚════════════════════════════════════════════════════════════════════════╝
  122. /*
  123.  
  124. sub_page run_title from run_stuff 1
  125. sub_page run_this from run_stuff 2
  126. sub_page run_button from run_stuff horizontal 3 3
  127.  
  128. /chain_stuff
  129. ╔════════════════════════════════════════════════════════════════════════╗
  130. ║________________________________________________________________________║
  131. ║                                                                        ║
  132. ║ DataFlex program: ____________________________________________________ ║
  133. ║                                                                        ║
  134. ║                   <_____>   <__________>  <_______>                    ║
  135. ╚════════════════════════════════════════════════════════════════════════╝
  136. /*
  137.  
  138. sub_page chain_title from chain_stuff 1
  139. sub_page chain_this from chain_stuff 2
  140. sub_page chain_button from chain_stuff horizontal 3 3
  141.  
  142. /file_1
  143. ╔═════════════════════════════════════════════════╗
  144. ║_________________________________________________║
  145. ║                                                 ║
  146. ║        File name: ____________                  ║
  147. ║     Directory is: _____________________________ ║
  148. ║                                                 ║
  149. ║                                                 ║
  150. ║      Files                Directories           ║
  151. ║      ┌─────────────┐      ┌─────────────┐       ║
  152. ║      │____________ │      │____________ │       ║
  153. ║      │____________ │      │____________ │       ║
  154. ║      │____________ │      │____________ │       ║
  155. ║      │____________ │      │____________ │       ║
  156. ║      │____________ │      │____________ │       ║
  157. ║      │____________ │      │____________ │       ║
  158. ║      │____________ │      │____________ │       ║
  159. ║      └─────────────┘      └─────────────┘       ║
  160. ║   <_________________>  <___________________>    ║
  161. ║        <_____>  <__________>  <_______>         ║
  162. ╚═════════════════════════════════════════════════╝
  163. /*
  164.  
  165. sub_page file_1_title from file_1 1
  166. sub_page file_1_spec from file_1 vertical 2 2
  167. sub_page file_1_file_list from file_1 vertical 4 7
  168. sub_page file_1_dir_list from file_1 vertical 5 7
  169. sub_page file_1_list_button from file_1 horizontal 18 2
  170. sub_page file_1_button from file_1 horizontal 20 3
  171.  
  172. format file_1.1 {autoclear}
  173. format file_1.2 {autoclear}
  174.  
  175. /file_2
  176. ╔═════════════════════════════════════════════════╗
  177. ║_________________________________________________║
  178. ║                                                 ║
  179. ║        File name: ____________                  ║
  180. ║     Directory is: _____________________________ ║
  181. ║   ___________ is: _____________________________ ║
  182. ║                                                 ║
  183. ║      Files                Directories           ║
  184. ║      ┌─────────────┐      ┌─────────────┐       ║
  185. ║      │____________ │      │____________ │       ║
  186. ║      │____________ │      │____________ │       ║
  187. ║      │____________ │      │____________ │       ║
  188. ║      │____________ │      │____________ │       ║
  189. ║      │____________ │      │____________ │       ║
  190. ║      │____________ │      │____________ │       ║
  191. ║      │____________ │      │____________ │       ║
  192. ║      └─────────────┘      └─────────────┘       ║
  193. ║   <_________________>  <___________________>    ║
  194. ║        <_____>  <__________>  <_______>         ║
  195. ╚═════════════════════════════════════════════════╝
  196. /*
  197.  
  198. sub_page file_2_title from file_2 1 4
  199. sub_page file_2_spec from file_2 vertical 2 3
  200. sub_page file_2_file_list from file_2 vertical 6 7
  201. sub_page file_2_dir_list from file_2 vertical 7 7
  202. sub_page file_2_list_button from file_2 horizontal 20 2
  203. sub_page file_2_button from file_2 horizontal 22 3
  204.  
  205. format file_2.1 {autoclear}
  206. format file_2.2 {autoclear}
  207. format file_2.3 {autoclear}
  208.  
  209. /working
  210. ╔═══════════════════════════════════════════════╗
  211. ║ _____________________________________________ ║
  212. ║ _____________________________________________ ║
  213. ╚═══════════════════════════════════════════════╝
  214. /invalid_spec
  215. ╔═══════════════════════════════════╗
  216. ║                                   ║
  217. ║          -- WARNING --            ║
  218. ║                                   ║
  219. ║ _________________________________ ║
  220. ║                                   ║
  221. ║ _________________________________ ║
  222. ║                                   ║
  223. ║                                   ║
  224. ║               <__>                ║
  225. ║                                   ║
  226. ╚═══════════════════════════════════╝
  227. /*
  228.  
  229. sub_page invalid_spec_button from invalid_spec 3
  230.  
  231. /nothing_marked
  232. ╔═══════════════════════════════════╗
  233. ║                                   ║
  234. ║          -- WARNING --            ║
  235. ║                                   ║
  236. ║     You have not selected any     ║
  237. ║                                   ║
  238. ║       files to be ________        ║
  239. ║                                   ║
  240. ║                                   ║
  241. ║               <__>                ║
  242. ║                                   ║
  243. ╚═══════════════════════════════════╝
  244. /*
  245.  
  246. sub_page nothing_marked_button from nothing_marked 2
  247.  
  248. /delete_confirm
  249. ╔═══════════════════════════════════╗
  250. ║                                   ║
  251. ║          -- WARNING --            ║
  252. ║                                   ║
  253. ║   You have selected files to be   ║
  254. ║                                   ║
  255. ║  deleted.  Do you really want to  ║
  256. ║                                   ║
  257. ║        delete these files?        ║
  258. ║                                   ║
  259. ║          <__>  <______>           ║
  260. ║                                   ║
  261. ╚═══════════════════════════════════╝
  262. /*
  263.  
  264. sub_page delete_confirm_button from delete_confirm horizontal 1 2
  265.  
  266. /dummy_console_title
  267. ______________________________________________________________________________
  268. /about
  269. ╔═════════════════════════════════════════════════════╗
  270. ║_____________________________________________________║
  271. ║                                                     ║
  272. ║                                                     ║
  273. ║                        Menu                         ║
  274. ║                                                     ║
  275. ║                    Version 1.00b                    ║
  276. ║                                                     ║
  277. ║                                                     ║
  278. ║     Copyright 1987-1992 Data Access Corporation     ║
  279. ║         Miami FL, USA - All rights reserved         ║
  280. ║                                                     ║
  281. ║               Memory: __________ Bytes              ║
  282. ║                                                     ║
  283. ║                    <__>  <____>                     ║
  284. ╚═════════════════════════════════════════════════════╝
  285. /* 
  286.  
  287. sub_page about_title from about 1 2
  288. sub_page about_button from about horizontal 3 2
  289.  
  290. indicator interrupted 
  291. // used to signal a user interrupt in listing files/directories to
  292. // the virtual console
  293.  
  294. // forward function declarations for functions that are used in the class
  295. // definitions below.  
  296. // the actual functions are defined further down.
  297. register_function ask_question integer qnum returns integer
  298. register_function reply returns string
  299. register_function validate string password returns integer
  300. register_function add_path string path string newdir returns string
  301. register_function check_flx string cmdtail returns integer
  302. register_function verify_delete returns integer
  303.  
  304. //****************************************************************************
  305. //
  306. //    Name: SELLIST
  307. // Purpose: skeleton picklist for DIR_LIST and FILE_LIST classes
  308. //
  309. //   Notes: This class is an auto-select list (one item is always selected
  310. //          unless the list is empty) and it can provide its parent with
  311. //          the selected item(s), one by one, and it can tell its parent
  312. //          if any items are selected.
  313. //
  314. //****************************************************************************
  315. class sellist is a list
  316.     procedure construct_object integer img
  317.         forward send construct_object img
  318.  
  319.         // default selection mode: always 1 item selected unless empty
  320.         set select_mode to auto_select
  321.  
  322.         // user may search by typing a name
  323.         set search_mode to incremental
  324.  
  325.         // selection cursor won't wrap
  326.         set wrap_state to false
  327.  
  328.         // this sets the entry message to be sent when receiving the focus
  329.         set entry_msg to initialize
  330.     end_procedure
  331.  
  332.     // this gets executed every time an object of this class gets the focus
  333.     procedure initialize
  334.         local integer dynupdt
  335.  
  336.         // when the list has no 'official' items
  337.         if (item_count(current_object)) lt 1 begin
  338.             // remember the current dynamic update state
  339.             get dynamic_update_state to dynupdt
  340.  
  341.             // this 'hides' changes to the list from becoming visible on 
  342.             // screen
  343.             set dynamic_update_state to false
  344.  
  345.             // initialize the list
  346.             send fill_list
  347.  
  348.             // restore the old dynamic update state
  349.             set dynamic_update_state to dynupdt
  350.         end
  351.     end_procedure
  352.  
  353.     // this is the default initialization
  354.     procedure fill_list
  355.         // wipe the list
  356.         send delete_data
  357.     end_procedure
  358.  
  359.     // this spoonfeeds each selected item to the instance, one at a time
  360.     procedure process_selections
  361.         local integer item#
  362.         local integer mx
  363.  
  364.         // calculate highest item number
  365.         move (item_count(current_object) - 1) to mx
  366.  
  367.         // do all items
  368.         for item# from 0 to mx
  369.             // if the current item is selected
  370.             if (select_state(current_object,item#)) ne 0 begin
  371.                 // send it to the instance
  372.                 send process_selection item#
  373.  
  374.                 // turn the selection off
  375.                 set select_state item item# to false
  376.             end
  377.         loop
  378.     end_procedure
  379.  
  380.     // this returns a 1 if items are slected and 0 if no items are selected
  381.     function check_selections returns integer
  382.         function_return (integer(select_count(current_object) > 0))
  383.     end_function
  384.  
  385.     // this returns the number of items in the list
  386.     function list_count returns integer
  387.         function_return (integer(item_count(current_object) > 0))
  388.     end_function
  389.  
  390.     // this is used to add new items at the bottom of the list
  391.     procedure select_and_rotate
  392.         set select_state to true
  393.         send next
  394.     end_procedure
  395. end_class
  396.  
  397. //****************************************************************************
  398. //
  399. //    Name: DIR_LIST
  400. // Purpose: picklist for directories
  401. //
  402. //   Notes: the following class 'knows' about listing directories in a 
  403. //          sellist and 'knows' about what message to send when a selected 
  404. //          item is processed.
  405. //
  406. //****************************************************************************
  407. class dir_list is a sellist
  408.     procedure construct_object integer list_image
  409.         forward send construct_object list_image
  410.  
  411.         // this defines the default accelerator key message
  412.         // it is set 'private' so children don't inherit it
  413.         on_key kenter send process_selections private
  414.     end_procedure
  415.  
  416.     // this loads the list according to the supplied filespec
  417.     procedure load_list string dirspec
  418.         local string astr
  419.  
  420.         // don't update the screen while it is filling
  421.         set dynamic_update_state to false
  422.  
  423.         // call the parent class procedure to clear the list
  424.         send fill_list
  425.  
  426.         // make sure at least ".." is in the list
  427.         send add_item msg_select_and_rotate ".."
  428.  
  429.         // append a backslash if needed
  430.         if (right(dirspec,1)) ne Dir_Separator append dirspec Dir_Separator
  431.  
  432.         // open the directory as a file
  433.         //
  434.         // note: directory names CAN HAVE extensions, although seldom used
  435.         //       that's why the filespec is "*.*"
  436.         direct_input ("DIR:" + dirspec + Wild_Card_Mask)
  437.         repeat
  438.             // read a filename
  439.             readln astr    
  440.             [not seqeof] trim astr to astr
  441.  
  442.             // check if it's a directory
  443.             [not seqeof] indicate got_one as (left(astr,1)) eq '['
  444.  
  445.             // trim off the square brackets
  446.             [not seqeof got_one] mid astr to astr (length(astr) - 2) 2
  447.  
  448.             // check if it's ".." (which we already have) 
  449.             [not seqeof got_one] indicate got_one as astr ne ".."
  450.  
  451.             // or '.' (which is useless for us)
  452.             [not seqeof got_one] indicate got_one as astr ne '.'
  453.  
  454.             // add it to the list
  455.             [not seqeof got_one] send add_item msg_select_and_rotate astr
  456.         until [seqeof]
  457.         close_input
  458.  
  459.         // sort the list
  460.         send sort_items ascending
  461.  
  462.         // this causes the screen to be updated
  463.         set dynamic_update_state to true
  464.     end_procedure
  465.  
  466.     // this gets called by the parent class when a directory is selected
  467.     procedure process_selection integer item#
  468.         // don't bother them with an item number, just give 'em the name
  469.         send dir_selected (value(current_object,item#))
  470.     end_procedure
  471. end_class
  472.  
  473. //****************************************************************************
  474. //
  475. //    Name: FILE_LIST
  476. // Purpose: picklist for files
  477. //
  478. //   Notes: the following class 'knows' about listing files in a 
  479. //          sellist and 'knows' about what message to send when a selected 
  480. //          item is processed.
  481. //
  482. //****************************************************************************
  483. class file_list is a sellist
  484.     procedure construct_object integer list_image
  485.         forward send construct_object list_image
  486.  
  487.         // we must be able to select multiple files
  488.         set select_mode to multi_select
  489.     end_procedure
  490.  
  491.     // this loads the list according to the supplied filespec and dirspec
  492.     procedure load_list string filespec string dirspec
  493.         local string astr
  494.  
  495.         // don't update the screen while it is filling
  496.         set dynamic_update_state to false
  497.  
  498.         // call the parent class procedure to clear the list
  499.         send fill_list
  500.  
  501.         // append a backslash if needed
  502.         if (right(dirspec,1)) ne Dir_Separator append dirspec Dir_Separator
  503.  
  504.         // open the directory as a file
  505.         direct_input ("DIR:" + dirspec + filespec)
  506.         repeat
  507.             // read a filename
  508.             readln astr
  509.             [not seqeof] trim astr to astr
  510.  
  511.             // check if it's not a directory
  512.             [not seqeof] indicate got_one as (left(astr,1)) ne '['
  513.  
  514.             // add it to the list
  515.             [not seqeof got_one] send add_item msg_select_and_rotate astr
  516.         until [seqeof]
  517.         close_input
  518.  
  519.         // sort the list
  520.         send sort_items ascending
  521.  
  522.         // this causes the screen to be updated
  523.         set dynamic_update_state to true
  524.     end_procedure
  525.  
  526.     // this gets called by the parent class for each selected file
  527.     procedure process_selection integer item#
  528.         // don't bother them with an item number, just give 'em the name
  529.         send file_selected (value(current_object,item#))
  530.     end_procedure
  531.  
  532.     // this entrypoint quickly selects/deselects all items
  533.     procedure select_all integer mode
  534.         // set the select count property (0 deselects, 1 or greater 
  535.         // selects all)
  536.         set select_count mode
  537.     end_procedure
  538. end_class
  539.  
  540. //****************************************************************************
  541. //
  542. //    Name: FILE_SPEC
  543. // Purpose: filespec entry form
  544. //
  545. //****************************************************************************
  546. class file_spec is a form
  547.     // this initializes the item windows
  548.     procedure init_specs
  549.         local string astring
  550.  
  551.         // default file spec
  552.         set value item 0 to Wild_Card_Mask
  553.  
  554.         // get the current directory name and set it up as the default
  555.         get_current_directory to astring
  556.         set value item 1 to astring
  557.  
  558.         // fill the lists using the defaults
  559.         send do_dirlist
  560.     end_procedure
  561.  
  562.     // this loads a new list of files if the filename item was changed
  563.     procedure get_filelist
  564.         local integer item_changed
  565.  
  566.         get item_changed_state item current to item_changed
  567.         if (item_changed = true) send do_filelist
  568.         send next
  569.     end_procedure
  570.  
  571.     // this loads a new list of files for the new directory if the directory 
  572.     // item was changed
  573.     procedure get_dirlist
  574.         local integer item_changed
  575.  
  576.         get item_changed_state item current to item_changed
  577.         if (item_changed = true) send do_dirlist
  578.         send next
  579.     end_procedure
  580.  
  581.     // this loads the filelist according to the entered directory- 
  582.     // and file specs
  583.     procedure do_filelist
  584.         send load_filelist (value(current_object,0)) (value(current_object,1))
  585.  
  586.         // flag the item back to unchanged; we're done with it
  587.         send item_done
  588.     end_procedure
  589.  
  590.     // this loads the directorylist according to the entered directory 
  591.     // specs and then reloads the file list
  592.     procedure do_dirlist
  593.         send load_dirlist (value(current_object,1))
  594.         send do_filelist
  595.  
  596.         // flag the item back to unchanged; we're done with it
  597.         send item_done
  598.     end_procedure
  599.  
  600.     // this flags all items back to unchanged
  601.     procedure item_done
  602.         set changed_state of current_object to false
  603.     end_procedure
  604.  
  605.     // this processes the directory name that was selected from the list
  606.     procedure dir_selected string thedir
  607.         local string path
  608.  
  609.         // get the current directory spec
  610.         get value item 1 to path
  611.  
  612.         // amend the current path with the supplied directory
  613.         set value item 1 to (add_path(current_object,path,thedir))
  614.  
  615.         // reload both lists
  616.         send do_dirlist
  617.     end_procedure
  618.  
  619.     // this checks if unprocessed item changes exist.
  620.     // If yes, then one or both lists are rebuilt
  621.     procedure check_changes
  622.         local integer has_changed
  623.  
  624.         // see if the directory spec has changed
  625.         get item_changed_state item 1 to has_changed
  626.         if (has_changed = true) send do_dirlist // this rebuilds both
  627.         else begin
  628.             // see if only the file spec has changed
  629.             get item_changed_state item 0 to has_changed
  630.             // this rebuilds files only
  631.             if (has_changed = true) send do_filelist 
  632.         end
  633.     end_procedure
  634. end_class
  635.  
  636. //****************************************************************************
  637. //
  638. //    Name: FILE_LIST_BUTTON
  639. // Purpose: general purpose buttons for a FILE_SPEC
  640. //
  641. //****************************************************************************
  642. class file_list_button is a button
  643.     procedure construct_object integer image
  644.         forward send construct_object image
  645.  
  646.         set focus_mode to pointer_only
  647.  
  648.         // set up the buttons
  649.         item_list
  650.             on_item "Alt+F1=Select All" send select_all_files
  651.             on_item "Alt+F2=Deselect All" send deselect_all_files
  652.         end_item_list
  653.     end_procedure
  654. end_class
  655.  
  656. //****************************************************************************
  657. //
  658. //    Name: FILE_CLIENT
  659. // Purpose: file manipulation skeleton
  660. //
  661. //   Notes: this defines the common structure of the five file operations
  662. //          copy, delete, rename, print and type
  663. //****************************************************************************
  664. class file_client is a client
  665.     procedure construct_object integer image
  666.         forward send construct_object image
  667.  
  668.         // prevent activation as a regular child
  669.         set focus_mode to no_activate
  670.  
  671.         // prevent mouse-activation of any objects outside of this one
  672.         set block_mouse_state to true
  673.  
  674.         // position the object's image on the screen
  675.         set location to 0 14 relative
  676.  
  677.         // prevent accelerator-key activation of the action bar
  678.         on_key kaction_bar send default_key
  679.  
  680.         on_key kuser send select_all_files
  681.         on_key kuser2 send deselect_all_files
  682.     end_procedure
  683.  
  684.     // these will be set up in the instances
  685.     register_object file_stuff
  686.     register_object dir_stuff
  687.  
  688.     // the procedures below route message traffic between siblings.
  689.     // it is 'a good thing' to NOT have siblings 'talk' to each other
  690.     // directly, since that would make them dependent on each other.
  691.     // so, to resolve this, their common parent must act as traffic cop.
  692.  
  693.     // this routes a message to its proper object
  694.     procedure load_filelist string filespec string dirspec
  695.         send load_list to (file_stuff(current_object)) filespec dirspec
  696.     end_procedure
  697.  
  698.     // this routes a message to its proper object
  699.     procedure load_dirlist string dirspec
  700.         send load_list to (dir_stuff(current_object)) dirspec
  701.     end_procedure
  702.  
  703.     // this routes a message to its proper object and returns the
  704.     // result to the caller
  705.     function check_selections returns integer
  706.         function_return (check_selections(file_stuff(current_object)))
  707.     end_function
  708.  
  709.     // this routes a message to its proper object and returns the
  710.     // result to the caller
  711.     function list_count returns integer
  712.         function_return (list_count(file_stuff(current_object)))
  713.     end_function
  714.  
  715.     // this routes a message to its proper object
  716.     procedure process_selections
  717.         send process_selections to (file_stuff(current_object))
  718.     end_procedure
  719.  
  720.     // this processes the "Select All" button
  721.     procedure select_all_files
  722.         // have file_stuff select all files
  723.         send select_all to (file_stuff(current_object)) true
  724.     end_procedure
  725.  
  726.     // this processes the "Deselect All" button
  727.     procedure deselect_all_files
  728.         // have file_stuff deselect all files
  729.         send select_all to (file_stuff(current_object)) false
  730.     end_procedure
  731. end_class
  732.  
  733. //****************************************************************************
  734. //
  735. //    Name: ABOUT
  736. // Purpose: provide information about the program
  737. //
  738. //****************************************************************************
  739. object about is a client
  740.     set location to 5 12 absolute
  741.     set block_mouse_state to true
  742.  
  743.     //************************************************************************
  744.     //
  745.     //    Name: ABOUT_TITLE
  746.     // Purpose: displays title of ABOUT object
  747.     //
  748.     //************************************************************************
  749.     object about_title is a title
  750.         set center_state item 0 to true
  751.         set value item 0 to "DataFlex Menu System"
  752.     end_object
  753.  
  754.     //************************************************************************
  755.     //
  756.     //    Name: ABOUT_BUTTON
  757.     // Purpose: implements buttons of ABOUT object
  758.     //
  759.     //************************************************************************
  760.     object about_button is a button
  761.         item_list
  762.             on_item "OK" send deactivate to (parent(current_object))
  763.             on_item "Help" send help
  764.         end_item_list
  765.  
  766.         procedure init
  767.             local integer mem
  768.  
  769.             memory mem
  770.             set value of (about_title(about.obj)) item 1 to mem
  771.         end_procedure
  772.  
  773.         send init
  774.     end_object
  775. end_object
  776.  
  777. procedure about
  778.     send activate to about.obj
  779. end_procedure
  780.  
  781. procedure focus_help for desktop
  782.     send help to (focus(desktop))
  783. end_procedure
  784.  
  785. //****************************************************************************
  786. //
  787. //    Name: MAIN
  788. // Purpose: main object
  789. //
  790. //****************************************************************************
  791. object main_object is a client
  792.     set location to 2 0 absolute
  793.  
  794.     // set up accelerator key for the action bar
  795.     on_key kaction_bar send do_action_bar
  796.     on_key kexit_application send quit
  797.  
  798.     //************************************************************************
  799.     //
  800.     //    Name: MAIN_TITLE
  801.     // Purpose: displays program title
  802.     //
  803.     //************************************************************************
  804.     object main_title is a title
  805.         set location to -2 0 relative
  806.         set center_state item 0 to true
  807.         set value item 0 to "DataFlex Menu System"
  808.     end_object
  809.  
  810.     //************************************************************************
  811.     //
  812.     //    Name: MENU_HEAD
  813.     // Purpose: displays menu title
  814.     //
  815.     //************************************************************************
  816.     object menu_head is a title
  817.         // this displays the menu header text
  818.         procedure display_title
  819.             set value item 0 to menu.header1
  820.             set value item 1 to menu.header2
  821.         end_procedure
  822.     end_object
  823.  
  824.     //************************************************************************
  825.     //
  826.     //    Name: MENU_BODY
  827.     // Purpose: implements navigation and activation of menu items
  828.     //
  829.     //************************************************************************
  830.     object menu_body is a menu
  831.         set auto_top_item_state to false
  832.  
  833.         register_object main_action_bar
  834.         register_object file_pulldown
  835.         register_object run_pulldown
  836.         register_object help_pull_down
  837.  
  838.         // set up accelerator keys
  839.         on_key key_alt+key_f send pull_down_file private
  840.         on_key key_alt+key_r send pull_down_run private
  841.         on_key key_alt+key_h send pull_down_help private
  842.         on_key kcancel send back_one // what to do on escape
  843.         on_key kdownarrow send go_down // what to do with up and down arrows
  844.         on_key kuparrow send go_up
  845.         on_key knext_item send go_down
  846.         on_key kprevious_item send go_up
  847.  
  848.         // set up the items for this object
  849.         item_list
  850.             repeat_item 9 times "" send do_action  // ie. execute the option
  851.         end_item_list
  852.  
  853.         procedure switch 
  854.         end_procedure
  855.  
  856.         procedure switch_back 
  857.         end_procedure
  858.  
  859.         // make sure the mouse can't select empty menu lines
  860.         procedure set current_item integer inum
  861.             indicate not valid_option as (shadow_state(current_object,inum)) 
  862.             [valid_option] forward set current_item to inum
  863.         end_procedure
  864.  
  865.         procedure mouse_click integer win integer char
  866.             [valid_option] forward send mouse_click win char
  867.         end_procedure
  868.  
  869.         procedure mouse_up integer win integer char
  870.             [valid_option] forward send mouse_up win char
  871.         end_procedure
  872.  
  873.         // this displays the menu that is currently in the buffer
  874.         procedure display_menu
  875.             local integer inum 
  876.             integer imin
  877.  
  878.             // go display the title
  879.             send display_title
  880.  
  881.             // keep track of which item is the first non-empty item
  882.             move 8 to imin
  883.  
  884.             // turn off automatic screen update
  885.             set dynamic_update_state to false
  886.  
  887.             // for all nine options do:
  888.             for inum from 0 to 8
  889.                 // make a pointer into the menu buffer
  890.                 move (inum * 3) to fieldindex
  891.  
  892.                 // write the option prompt to the image
  893.                 set value item inum to menu.pr1&
  894.  
  895.                 // check if it's empty and shadow the item if it's empty
  896.                 if (trim(menu.pr1&)) eq "" set shadow_state item inum to true
  897.                 else begin
  898.                     // un-shadow it to be safe (might be left shadowed by 
  899.                     // previous menu)
  900.                     set shadow_state item inum to false
  901.  
  902.                     // check if this is the first non-empty item
  903.                     move (inum min imin) to imin
  904.                 end
  905.  
  906.                 // start at the first non-empty item
  907.                 set current_item to imin
  908.             loop
  909.  
  910.             // show the updated menu image
  911.             set dynamic_update_state to true
  912.  
  913.             // remember which menu is currently loaded
  914.             move menu.recnum to next_menu
  915.         end_procedure
  916.  
  917.         // this loads a specified menu
  918.         procedure load_menu integer thisone
  919.             // go get the menu record
  920.             move thisone to menu.recnum
  921.             find eq menu.recnum
  922.  
  923.             // if it exists, then show it
  924.             [found] send display_menu
  925.  
  926.             // else default to the main menu
  927.             [finderr] send load_menu 1
  928.             // nb. observe that this is a recursive call!
  929.         end_procedure
  930.  
  931.         // this backs up to the parent menu
  932.         procedure back_one
  933.             send load_menu (integer(menu.default))
  934.         end_procedure
  935.  
  936.         // this initializes the menu body object
  937.         procedure activating
  938.             // eat all keys pressed since invocation
  939.             repeat
  940.                 keycheck
  941.             [keypress] loop
  942.  
  943.             // load the main menu or reload the last used menu
  944.             send load_menu next_menu
  945.  
  946.             forward send activating
  947.         end_procedure
  948.  
  949.         // this moves the selection cursor to the next non-empty option
  950.         // this will wrap up if necessary
  951.         procedure go_down
  952.             local integer icount inum istate
  953.  
  954.             // find out where we are
  955.             get current_item to inum
  956.  
  957.             // try upto nine times
  958.             for icount from 0 to 8
  959.                 // go to the next option
  960.                 increment inum
  961.  
  962.                 // wrap if necessary
  963.                 if inum gt 8 move 0 to inum
  964.  
  965.                 // find out if this option is non-empty
  966.                 get shadow_state item inum to istate
  967.  
  968.                 // terminate loop early if a non-empty (non-shadowed) option 
  969.                 // is found
  970.                 if (istate = false) move 8 to icount
  971.             loop
  972.  
  973.             // move the selection cursor to the new option
  974.             set current_item to inum
  975.         end_procedure
  976.  
  977.         // this moves the selection cursor to the previous non-empty option
  978.         // this will wrap up if necessary
  979.         procedure go_up
  980.             local integer icount inum istate
  981.  
  982.             // find out where we are
  983.             get current_item to inum
  984.  
  985.             // try upto nine times
  986.             for icount from 0 to 8
  987.                 // go to the previous option
  988.                 decrement inum
  989.  
  990.                 // wrap if necessary
  991.                 if inum lt 0 move 8 to inum
  992.  
  993.                 // find out if this option is non-empty
  994.                 get shadow_state item inum to istate
  995.  
  996.                 // terminate loop early if a non-empty (non-shadowed) option 
  997.                 // is found
  998.                 if (istate = false) move 8 to icount
  999.             loop
  1000.  
  1001.             // move the selection cursor to the new option
  1002.             set current_item to inum
  1003.         end_procedure
  1004.  
  1005.         // this executes the action as defined for this option
  1006.         procedure do_action
  1007.             local string action password cmdhead cmdtail qtoken
  1008.             local integer space inum qpos qnum
  1009.  
  1010.             // find out where we are
  1011.             get current_item to inum
  1012.  
  1013.             // make a pointer into the menu buffer
  1014.             move (inum * 3) to fieldindex
  1015.  
  1016.             // get the action
  1017.             trim menu.ac1& to action
  1018.  
  1019.             // forget it if there is no action
  1020.             indicate go as action gt ""
  1021.  
  1022.             [go] begin
  1023.                 // see if there is a password attached to this option
  1024.                 trim menu.pw1& to password
  1025.                 indicate go as password eq "" 
  1026.  
  1027.                 // there is a password, so go ask for it
  1028.                 [not go] indicate go as (validate(current_object,password))
  1029.             end
  1030.  
  1031.             [go] begin
  1032.                 // check for questions in the action
  1033.                 repeat
  1034.                     // set up the string search for a question token
  1035.                     move '$' to qtoken
  1036.  
  1037.                     // is there a question?
  1038.                     pos qtoken in action to qpos
  1039.  
  1040.                     if qpos begin
  1041.                         // remember which question token to replace with the 
  1042.                         // answer
  1043.                         mid action to qnum 1 (qpos + 1)
  1044.                         append qtoken qnum
  1045.  
  1046.                         // go ask the question
  1047.                         indicate go as (ask_question(current_object,qnum)) ;
  1048.                             eq msg_ok
  1049.  
  1050.                         // replace the token if the question was answered 
  1051.                         // normally
  1052.                         [go] replace qtoken in action with ;
  1053.                             (reply(current_object))
  1054.                     end
  1055.                 // keep going until all questions are answered, or until
  1056.                 // the user stopped the questions-and-answers session
  1057.                 [go] until qpos eq 0 
  1058.             end
  1059.  
  1060.             [go] begin
  1061.                 // parse the action
  1062.                 pos ' ' in action to space
  1063.                 if space begin
  1064.                     trim (right(action,(length(action) - space))) to cmdtail
  1065.                     uppercase (left(action,(space - 1))) to cmdhead
  1066.                 end
  1067.                 else begin
  1068.                     uppercase action to cmdhead
  1069.                     move "" to cmdtail
  1070.                 end
  1071.  
  1072.                 // load the requested menu
  1073.                 if cmdhead eq "MENU" send load_menu (integer(cmdtail))
  1074.  
  1075.                 // exit to the O/S
  1076.                 else if cmdhead eq "SYSTEM" send quit
  1077.  
  1078.                 // run the requested DataFlex program
  1079.                 else if cmdhead eq "CHAIN" begin
  1080.                     // proceed only when there is something to run in the 
  1081.                     // first place
  1082.                     if cmdtail gt "" begin
  1083.                         // find out in what mode to run this thing
  1084.                         if (pos("WAIT ",uppercase(cmdtail)) = 1) begin
  1085.                             // trim off the WAIT word
  1086.                             trim (right(cmdtail,(length(cmdtail) - 5))) ;
  1087.                                 to cmdtail
  1088.  
  1089.                             // check if the program can be found in dfpath
  1090.                             if (check_flx(current_object,cmdtail)) begin
  1091.                                 // run it as a child
  1092.                                 chain wait cmdtail
  1093.  
  1094.                                 // rebuild the screen upon return
  1095.                                 send refresh_screen
  1096.                             end
  1097.                         end
  1098.  
  1099.                         // run it as a sibling when the program can be found 
  1100.                         // in dfpath
  1101.                         else if (check_flx(current_object,cmdtail)) ;
  1102.                             chain cmdtail
  1103.                     end
  1104.                 end
  1105.  
  1106.                 // copy the requested file(s)
  1107.                 else if cmdhead eq "COPYFILE" begin
  1108.                     // get the source and the destination specs
  1109.                     pos ' ' in cmdtail to space
  1110.                     left cmdtail to cmdhead (space - 1)
  1111.                     trim (right(cmdtail,(length(cmdtail) - space))) ;
  1112.                         to cmdtail
  1113.  
  1114.                     // proceed only if:
  1115.                     // 1) there is something to copy, and
  1116.                     // 2) there is a place to copy it to
  1117.                     if ((cmdhead > "") and (cmdtail > "")) begin
  1118.                         // show what we're about to copy
  1119.                         send working_on "Copying:" cmdhead
  1120.  
  1121.                         // copy it
  1122.                         send copy_it cmdhead cmdtail
  1123.  
  1124.                         // remove the "working on" message
  1125.                         send working_off
  1126.                     end
  1127.                 end
  1128.  
  1129.                 // delete the requested file(s)
  1130.                 else if cmdhead eq "ERASEFILE" begin
  1131.                     // proceed only if there is something to delete
  1132.                     if (cmdtail > "") begin
  1133.                         if (verify_delete(current_object) = msg_ok) begin
  1134.                             // show what we're about to delete
  1135.                             send working_on "Deleting:" cmdtail
  1136.  
  1137.                             // delete it
  1138.                             send delete_it cmdtail
  1139.  
  1140.                             // remove the "working on" message
  1141.                             send working_off
  1142.                         end
  1143.                     end
  1144.                 end
  1145.  
  1146.                 // rename the requested file(s)
  1147.                 else if cmdhead eq "RENAMEFILE" begin
  1148.                     // get the old- and new name specs
  1149.                     pos ' ' in cmdtail to space
  1150.                     left cmdtail to cmdhead (space - 1)
  1151.                     trim (right(cmdtail,(length(cmdtail) - space))) ;
  1152.                         to cmdtail
  1153.  
  1154.                     // proceed only if:
  1155.                     // 1) there is something to rename, and
  1156.                     // 2) a new name is provided
  1157.                     if ((cmdhead > "") and (cmdtail > "")) begin
  1158.                         // show what we're about to rename
  1159.                         send working_on "Renaming:" cmdhead
  1160.  
  1161.                         // rename it
  1162.                         send rename_it cmdhead cmdtail
  1163.  
  1164.                         // remove the "working on" message
  1165.                         send working_off
  1166.                     end
  1167.                 end
  1168.  
  1169.                 // type the requested file(s)
  1170.                 else if cmdhead eq "TYPE" begin
  1171.                     // proceed only if there is something to type
  1172.                     if (cmdtail > "") send type_it cmdtail
  1173.                 end
  1174.  
  1175.                 // list the specified directory/filespec
  1176.                 else if cmdhead eq "DIRECTORY" begin
  1177.                     if cmdtail eq "" move Wild_Card_Mask to cmdtail
  1178.  
  1179.                     // open the directory as a file
  1180.                     direct_input  ("DIR:" + cmdtail)
  1181.  
  1182.                     // turn on our virtual console
  1183.                     send virtual_console_on ("Directory of " + cmdtail)
  1184.  
  1185.                     repeat
  1186.                         // reset our output line to empty
  1187.                         move "" to cmdhead
  1188.  
  1189.                         repeat
  1190.                             // read a filename
  1191.                             readln cmdtail
  1192.  
  1193.                             // if we have read a filename, then pad it to 
  1194.                             // our output line
  1195.                             [not seqeof] append cmdhead (pad(cmdtail,16))
  1196.  
  1197.                         // keep going until:
  1198.                         // 1) there is nothing more to read, or
  1199.                         // 2) our output line is over 78 characters long
  1200.                         [not seqeof] until (length(cmdhead) > 78)
  1201.  
  1202.                         // do we have something to write?
  1203.                         if cmdhead gt ""begin
  1204.                             // adjust the output line length to the
  1205.                             // width of the virtual console
  1206.                             pad cmdhead to cmdhead 78
  1207.  
  1208.                             // write the output line and check for user 
  1209.                             // interrupt
  1210.                             send write_a_line cmdhead
  1211.                         end
  1212.  
  1213.                     // keep going until:
  1214.                     // 1) all files are listed, or
  1215.                     // 2) the listing was interrupted
  1216.                     [not seqeof not interrupted] loop
  1217.  
  1218.                     // turn off the virtual console (give it back to the 
  1219.                     // desktop)
  1220.                     send virtual_console_off
  1221.  
  1222.                     // close the directory file
  1223.                     close_input
  1224.                 end
  1225.  
  1226.                 // run the action as a regular program
  1227.                 else begin
  1228.                     send run action
  1229.                     set current_item to imin
  1230.                 end
  1231.             end
  1232.         end_procedure
  1233.     end_object
  1234.  
  1235.     //************************************************************************
  1236.     //
  1237.     //    Name: MENU_BUTTON
  1238.     // Purpose: implements general purpose program buttons
  1239.     //
  1240.     //************************************************************************
  1241.     object menu_button is a button
  1242.         set focus_mode to pointer_only
  1243.  
  1244.         item_list
  1245.             on_item "Esc=Previous Menu" send back_one
  1246.             on_item "Alt+F4=Exit" send quit
  1247.             on_item "F1=Help" send focus_help
  1248.         end_item_list
  1249.     end_object
  1250.  
  1251.     //************************************************************************
  1252.     //
  1253.     //    Name: MAIN_ACTION_BAR 
  1254.     // Purpose: implements program's action bar
  1255.     //
  1256.     //************************************************************************
  1257.     create_menu main_action_bar 
  1258.         set location to -1 0 relative
  1259.         // always position on second line of client area (CUA spec)
  1260.  
  1261.         // this defines the "File" pulldown menu
  1262.         on_item "File" begin_pull_down file_pull_down
  1263.             // set up pulldown items
  1264.             on_item "Copy...           " send do_copy
  1265.             on_item "Delete...       " send do_delete
  1266.             on_item "Print...        " send do_print
  1267.             on_item "Rename...       " send do_rename
  1268.             on_item "Type...         " send do_type
  1269.             on_item "Exit      Alt+F4" send quit // MUST BE "Exit" (CUA spec)
  1270.         end_pull_down
  1271.  
  1272.         // this defines the "Run" pulldown menu
  1273.         on_item "Run" begin_pull_down run_pull_down
  1274.             // set up pulldown items
  1275.             on_item "DataFlex Program..."    send do_chain
  1276.             on_item "System Command..."        send do_run
  1277.             on_item "O/S Shell"                        send do_os
  1278.         end_pull_down
  1279.  
  1280.         // this defines the "Help" pulldown menu
  1281.         #include helpa_pd.inc
  1282.  
  1283.         procedure pull_down_file
  1284.             send activate_pull_down to (file_pull_down(current_object))
  1285.         end_procedure
  1286.  
  1287.         procedure pull_down_run
  1288.             send activate_pull_down to (run_pull_down(current_object))
  1289.         end_procedure
  1290.  
  1291.         procedure pull_down_help
  1292.             send activate_pull_down to (help_pull_down(current_object))
  1293.         end_procedure
  1294.     end_menu
  1295.  
  1296.     //************************************************************************
  1297.     //
  1298.     //    Name: PASSWORD
  1299.     // Purpose: implements password entry and verification
  1300.     //
  1301.     //************************************************************************
  1302.     object password is a message
  1303.         // prevent activation as a regular child
  1304.         set focus_mode to no_activate
  1305.  
  1306.         // fancy way to position the object two lines above the end of its 
  1307.         // parent's area
  1308.         set location to (main_object.lines - password.lines - 2) 21 relative
  1309.  
  1310.         // prevent activation of any objects outside of this one
  1311.         set block_mouse_state to true
  1312.         on_key kaction_bar send default_key
  1313.  
  1314.         // auto-center the two windows
  1315.         set center_state item 0 to true
  1316.         set center_state item 1 to true
  1317.  
  1318.         //********************************************************************
  1319.         //
  1320.         //    Name: INVALID_PASSWORD
  1321.         // Purpose: notifies user of invalid password
  1322.         //
  1323.         //********************************************************************
  1324.         object invalid_password is a warning_msg
  1325.             // prevent activation as a regular child
  1326.             set focus_mode to no_activate
  1327.  
  1328.             // auto-center the window
  1329.             set center_state item 0 to true
  1330.  
  1331.             // this notifies the user of the invalid password
  1332.             procedure tell_em
  1333.                 // put the message in the window
  1334.                 set value item 0 to "Invalid password for this option!"
  1335.  
  1336.                 // allow it to become visible
  1337.                 set focus_mode to focusable
  1338.  
  1339.                 // make it visible
  1340.                 send activate
  1341.  
  1342.                 // wait three seconds
  1343.                 sleep 3
  1344.  
  1345.                 // remove the message
  1346.                 send deactivate
  1347.  
  1348.                 // return to the default activation mode
  1349.                 set focus_mode to no_activate
  1350.             end_procedure
  1351.         end_object
  1352.  
  1353.         // this validates an entered password against the supplied one
  1354.         function validate string password returns integer
  1355.             local integer okay
  1356.             local string stemp akey
  1357.  
  1358.             // put the message in the first window
  1359.             set value item 0 to "Enter the password for this option"
  1360.  
  1361.             // clear the second window
  1362.             set value item 1 to ""
  1363.  
  1364.             // allow it to become visible
  1365.             set focus_mode to focusable
  1366.  
  1367.             // make it visible
  1368.             send activate
  1369.  
  1370.             // start from scratch
  1371.             move "" to stemp
  1372.  
  1373.             repeat
  1374.                 // wait for a key
  1375.                 inkey akey
  1376.  
  1377.                  // if it is not the return key, then...
  1378.                 [not key.return] begin
  1379.                     // append it to what we have already
  1380.                     append stemp akey
  1381.  
  1382.                     // add a question mark to the second window to show we 
  1383.                     // got the key
  1384.                     set value item 1 (trim((value(current_object,1))) + '?')
  1385.                 end
  1386.  
  1387.             // keep going until the return key is pressed
  1388.             until [key.return]
  1389.  
  1390.             // go away
  1391.             send deactivate
  1392.  
  1393.             // reset the default activation mode
  1394.             set focus_mode to no_activate
  1395.  
  1396.             // compare against the supplied password
  1397.             move (password = stemp) to okay
  1398.  
  1399.             // if it's wrong, then tell the user
  1400.             if not okay send tell_em to (invalid_password(current_object))
  1401.  
  1402.             // return the result to the caller
  1403.             function_return okay
  1404.         end_function
  1405.     end_object
  1406.  
  1407.     //************************************************************************
  1408.     //
  1409.     //    Name: QUESTION
  1410.     // Purpose: implements the asking of questions for menu items
  1411.     //
  1412.     //************************************************************************
  1413.     object question is a client
  1414.         // prevent activation as a regular child
  1415.         set focus_mode to no_activate
  1416.  
  1417.         on_key ksave_record send ok
  1418.         on_key kcancel send cancel
  1419.  
  1420.         // fancy way to position the object one line above the end of its 
  1421.         // parent's area
  1422.         set location to (main_object.lines - question.lines - 1) 12 relative
  1423.  
  1424.         // prevent activation of any objects outside of this one
  1425.         set block_mouse_state to true
  1426.         on_key kaction_bar send default_key
  1427.  
  1428.         //********************************************************************
  1429.         //
  1430.         //    Name: QUESTION_TEXT
  1431.         // Purpose: displays the question
  1432.         //
  1433.         //********************************************************************
  1434.         object question_text is a title
  1435.             // this displays the question text
  1436.             procedure display_question string q1 string q2
  1437.                 set value item 0 to q1
  1438.                 set value item 1 to q2
  1439.             end_procedure
  1440.         end_object
  1441.  
  1442.         //********************************************************************
  1443.         //
  1444.         //    Name: QUESTION_REPLY
  1445.         // Purpose: implements entry of a response to a question
  1446.         //
  1447.         //********************************************************************
  1448.         object question_reply is a form
  1449.             set local_rotate_state to true
  1450.  
  1451.             // set up the reply item window
  1452.             item_list
  1453.                 on_item "" send next
  1454.             end_item_list
  1455.  
  1456.             // this initializes the reply item window
  1457.             procedure activating
  1458.                 // clear the reply item window
  1459.                 set value item 0 to ""
  1460.                 forward send activating
  1461.             end_procedure
  1462.  
  1463.             // this returns the contents of the reply item window to the 
  1464.             // caller
  1465.             function reply returns string
  1466.                 function_return (value(current_object,0))
  1467.             end_function
  1468.         end_object
  1469.  
  1470.         //********************************************************************
  1471.         //
  1472.         //    Name: QUESTION_BUTTON
  1473.         // Purpose: implements Q&A buttons
  1474.         //
  1475.         //********************************************************************
  1476.         object question_button is a button
  1477.             // set up the button item windows and their messages when 
  1478.             // clicked on
  1479.             item_list
  1480.                 on_item "F2=OK" send ok
  1481.                 on_item "Esc=Cancel" send cancel
  1482.                 on_item "F1=Help" send help
  1483.             end_item_list
  1484.         end_object
  1485.  
  1486.         // this asks a question and lets the user enter a reply
  1487.         function ask_question integer qnum returns integer
  1488.             local integer result_msg
  1489.  
  1490.             // allow the reply object to take the focus
  1491.             set focus_mode to focusable
  1492.  
  1493.             // make a pointer into the menu buffer
  1494.             move ((qnum - 1) * 2) to fieldindex
  1495.  
  1496.             // show the question text
  1497.             send display_question to (question_text(current_object)) ;
  1498.                 menu.qa1& menu.qb1&
  1499.  
  1500.             // let the user reply (returns either the msg_ok or msg_cancel 
  1501.             // message)
  1502.             ui_accept current_object to result_msg
  1503.  
  1504.             // return the result message to the caller
  1505.             function_return result_msg
  1506.         end_function
  1507.  
  1508.         // this routes a reply request to the proper object
  1509.         function reply returns string
  1510.             function_return (reply(question_reply(current_object)))
  1511.         end_function
  1512.     end_object
  1513.  
  1514.     //************************************************************************
  1515.     //
  1516.     //    Name: RUN_STUFF
  1517.     // Purpose: implements entry and invocation of executables
  1518.     //
  1519.     //************************************************************************
  1520.     object run_stuff is a client
  1521.         // prevent activation as a regular child
  1522.         set focus_mode to no_activate
  1523.  
  1524.         // fancy way to position the object one line above the end of its 
  1525.         // parent's area
  1526.         set location to (main_object.lines - run_stuff.lines - 1) 3 relative
  1527.         set local_rotate_state to true
  1528.  
  1529.         // prevent activation of any objects outside of this one
  1530.         set block_mouse_state to true
  1531.         on_key kaction_bar send default_key
  1532.  
  1533.         // set up accelerator keys
  1534.         on_key ksave_record send run_it
  1535.         on_key kcancel send run_stuff_off
  1536.  
  1537.         //********************************************************************
  1538.         //
  1539.         //    Name: RUN_TITLE
  1540.         // Purpose: displays title of RUN_STUFF object
  1541.         //
  1542.         //********************************************************************
  1543.         object run_title is a title
  1544.             set center_state item 0 to true
  1545.             set value item 0 to "Run A System Command..."
  1546.         end_object
  1547.  
  1548.         //********************************************************************
  1549.         //
  1550.         //    Name: RUN_THIS
  1551.         // Purpose: implements entry of executable's name
  1552.         //
  1553.         //********************************************************************
  1554.         object run_this is a form
  1555.             // set up the items
  1556.             item_list
  1557.                 on_item "" send next
  1558.             end_item_list
  1559.  
  1560.             // this initializes the item window
  1561.             procedure activating
  1562.                 set value item 0 to ""
  1563.             end_procedure
  1564.         end_object
  1565.  
  1566.         //********************************************************************
  1567.         //
  1568.         //    Name: RUN_BUTTONS
  1569.         // Purpose: implements buttons of the RUN_STUFF object
  1570.         //
  1571.         //********************************************************************
  1572.         object run_button is a button
  1573.             // set up the button items
  1574.             item_list
  1575.                 on_item "F2=OK" send run_it
  1576.                 on_item "Esc=Cancel" send run_stuff_off
  1577.                 on_item "F1=Help" send help
  1578.             end_item_list
  1579.         end_object
  1580.  
  1581.         // this activates the object
  1582.         procedure run_stuff_on
  1583.             // allow to become visible and to take the focus
  1584.             set focus_mode to focusable
  1585.  
  1586.             // give it the focus
  1587.             send activate
  1588.         end_procedure
  1589.  
  1590.         // this deactivates the object
  1591.         procedure run_stuff_off
  1592.             // return the focus to whoever had it before
  1593.             send deactivate
  1594.  
  1595.             // reset the default activation mode
  1596.             set focus_mode to no_activate
  1597.         end_procedure
  1598.  
  1599.         // this executes the supplied command
  1600.         procedure run string theprogram
  1601.             local string cmd
  1602.             local string arg
  1603.             local integer space
  1604.  
  1605.             // remove this object's image
  1606.             send run_stuff_off
  1607.  
  1608.             // return to normal screen i/o
  1609.             screen_optimize false
  1610.  
  1611.             // clear the screen
  1612.             clearscreen
  1613.  
  1614.             // see if a command was specified
  1615.             trim theprogram to cmd
  1616.             if cmd ne "" begin
  1617.                 // separate the command from its arguments (if any)
  1618.                 pos ' ' in cmd to space
  1619.                 if space begin
  1620.                     move (trim(right(cmd,(length(cmd) - space)))) to arg
  1621.                     left cmd to cmd (space - 1)
  1622.                 end
  1623.                 else move "" to arg
  1624.  
  1625.                 // execute it
  1626.                 runprogram cmd arg
  1627.                 clearscreen 
  1628.             end
  1629.  
  1630.             // no command specified, we're going to run a shell
  1631.             else begin
  1632.                 // tell the user what to do to get back to us
  1633.                 showln 'Enter "EXIT" to return to DataFlex.'
  1634.  
  1635.                 // run the shell
  1636.                 runprogram wait
  1637.                 clearscreen 
  1638.             end
  1639.  
  1640.             // return to optimized screen i/o
  1641.             screen_optimize true
  1642.  
  1643.             // repaint the screen
  1644.             send refresh_screen
  1645.         end_procedure
  1646.  
  1647.         // this processes the OK message on the entered command
  1648.         procedure run_it
  1649.             send run (value(run_this(current_object),0))
  1650.         end_procedure
  1651.  
  1652.         // this processes an external request to run a shell
  1653.         procedure run_shell
  1654.             send run ""
  1655.         end_procedure
  1656.     end_object
  1657.  
  1658.     //************************************************************************
  1659.     //
  1660.     //    Name: CHAIN_STUFF
  1661.     // Purpose: implements entry and invocation of DataFlex programs
  1662.     //
  1663.     //************************************************************************
  1664.     object chain_stuff is a client
  1665.         // prevent activation as a regular child
  1666.         set focus_mode to no_activate
  1667.  
  1668.         // fancy way to position the object one line above the end of its 
  1669.         // parent's area
  1670.         set location to (main_object.lines - chain_stuff.lines - 1) 3 relative
  1671.         set local_rotate_state to true
  1672.  
  1673.         // prevent activation of any objects outside of this one
  1674.         set block_mouse_state to true
  1675.         on_key kaction_bar send default_key
  1676.  
  1677.         // set up accelerator keys
  1678.         on_key ksave_record send chain_it
  1679.         on_key kcancel send chain_stuff_off
  1680.  
  1681.         //********************************************************************
  1682.         //
  1683.         //    Name: CHAIN_TITLE
  1684.         // Purpose: displays title of CHAIN_STUFF object
  1685.         //
  1686.         //********************************************************************
  1687.         object chain_title is a title
  1688.             set center_state item 0 to true
  1689.             set value item 0 to "Run A DataFlex Program..."
  1690.         end_object
  1691.  
  1692.         //********************************************************************
  1693.         //
  1694.         //    Name: CHAIN_THIS
  1695.         // Purpose: implements entry of DataFlex program's name
  1696.         //
  1697.         //********************************************************************
  1698.         object chain_this is a form
  1699.             // set up the items
  1700.             item_list
  1701.                 on_item "" send next
  1702.             end_item_list
  1703.  
  1704.             // this initializes the item window
  1705.             procedure activating
  1706.                 set value item 0 to ""
  1707.             end_procedure
  1708.         end_object
  1709.  
  1710.         //********************************************************************
  1711.         //
  1712.         //    Name: CHAIN_BUTTON
  1713.         // Purpose: implements buttons of CHAIN_STUFF object
  1714.         //
  1715.         //********************************************************************
  1716.         object chain_button is a button
  1717.             // set up the button items
  1718.             item_list
  1719.                 on_item "F2=OK" send chain_it
  1720.                 on_item "Esc=Cancel" send chain_stuff_off
  1721.                 on_item "F1=Help" send help
  1722.             end_item_list
  1723.         end_object
  1724.  
  1725.         // this activates the object
  1726.         procedure chain_stuff_on
  1727.             // allow to become visible and to take the focus
  1728.             set focus_mode to focusable
  1729.  
  1730.             // give it the focus
  1731.             send activate
  1732.         end_procedure
  1733.  
  1734.         // this deactivates the object
  1735.         procedure chain_stuff_off
  1736.             // return the focus to whoever had it before
  1737.             send deactivate
  1738.  
  1739.             // reset the default activation mode
  1740.             set focus_mode to no_activate
  1741.         end_procedure
  1742.  
  1743.         // this processes the "OK" button
  1744.         procedure chain_it
  1745.             local string cmdtail
  1746.  
  1747.             get value of (chain_this(current_object)) to cmdtail
  1748.             // proceed only if there is something to chain to
  1749.             if cmdtail gt "" begin
  1750.                 // check if the program can be found in dfpath and, 
  1751.                 // if yes, chain to it
  1752.                 if (check_flx(current_object,cmdtail)) chain cmdtail
  1753.             end
  1754.             // remove the object's image
  1755.             send chain_stuff_off
  1756.         end_procedure
  1757.     end_object
  1758.  
  1759.     //************************************************************************
  1760.     //
  1761.     //    Name: FILE_COPY
  1762.     // Purpose: implements the copy file function
  1763.     //
  1764.     //************************************************************************
  1765.     object file_copy is a file_client file_2
  1766.         on_key ksave_record send copy_ok
  1767.         on_key kcancel send file_copy_off
  1768.  
  1769.         //********************************************************************
  1770.         //
  1771.         //    Name: FILE_COPY_TITLE
  1772.         // Purpose: displays title of FILE_COPY object
  1773.         //
  1774.         //********************************************************************
  1775.         object file_copy_title is a title file_2_title
  1776.             set center_state item 0 to true
  1777.             set shadow_state item 1 to true
  1778.         end_object
  1779.  
  1780.         //********************************************************************
  1781.         //
  1782.         //    Name: FILE_COPY_SPEC
  1783.         // Purpose: implements entry of filespec
  1784.         //
  1785.         //********************************************************************
  1786.         object file_copy_spec is a file_spec file_2_spec
  1787.             // set up the items
  1788.             item_list
  1789.                 on_item "" send get_filelist
  1790.                 on_item "" send get_dirlist
  1791.                 on_item "" send next
  1792.             end_item_list
  1793.  
  1794.             procedure init_specs
  1795.                 forward send init_specs
  1796.                 set value item 2 to ""
  1797.             end_procedure
  1798.  
  1799.             // this copies file(s) from source to destination
  1800.             procedure copy_it string source string destination
  1801.                 copyfile source to destination
  1802.             end_procedure
  1803.  
  1804.             // this informs the user what is copied
  1805.             procedure copying string source string destination
  1806.                 // proceed only if there is a destination
  1807.                 if (value(current_object,2)) gt "" begin
  1808.                     // show what is going to be copied
  1809.                     send working_on "Copying:" source
  1810.  
  1811.                     // copy it
  1812.                     send copy_it source destination
  1813.                 end
  1814.  
  1815.                 // no destination given: show a warning message
  1816.                 else send spec_invalid "You have not specified" ;
  1817.                     "the destination!"
  1818.             end_procedure
  1819.  
  1820.             // this processes a file that was selected from the list
  1821.             procedure file_selected string thefile
  1822.                 local string source destination
  1823.  
  1824.                 // get the path
  1825.                 trim (value(current_object,1)) to source
  1826.  
  1827.                 // append a backslash if needed
  1828.                 if (right(source,1)) ne Dir_Separator append source Dir_Separator
  1829.  
  1830.                 // append the supplied filename
  1831.                 append source thefile
  1832.  
  1833.                 // get the destination
  1834.                 trim (value(current_object,2)) to destination
  1835.  
  1836.                 // go copy it
  1837.                 send copying source destination
  1838.             end_procedure
  1839.  
  1840.             // this processes the OK message
  1841.             procedure copy_ok
  1842.                 local string source destination
  1843.  
  1844.                 if (changed_state(current_object) = true) send check_changes
  1845.  
  1846.                 // if files were selected from the list, then let the 
  1847.                 // list tell us which ones were selected
  1848.                 if (check_selections(current_object)) begin
  1849.                     send process_selections
  1850.  
  1851.  
  1852.                     // turn off the "working on" message
  1853.                     send working_off
  1854.  
  1855.                     // reload file list
  1856.                     send do_filelist
  1857.                 end
  1858.                 // else, tell 'em to select files first
  1859.                 else send nothing_to_do 'copied.'
  1860.             end_procedure
  1861.         end_object
  1862.  
  1863.         //********************************************************************
  1864.         //
  1865.         //    Name: FILE_STUFF
  1866.         // Purpose: displays selection list of files
  1867.         //
  1868.         //********************************************************************
  1869.         object file_stuff is a file_list file_2_file_list
  1870.         end_object
  1871.  
  1872.         // this defines the directory list (see class definition above)
  1873.         object dir_stuff is a dir_list file_2_dir_list
  1874.         end_object
  1875.  
  1876.         // this defines the select-all and deselect-all buttons
  1877.         object file_copy_list_button is a file_list_button file_2_list_button
  1878.         end_object
  1879.  
  1880.         // this sets up the buttons for this module
  1881.         object file_copy_button is a button file_2_button
  1882.             set focus_mode to pointer_only
  1883.  
  1884.             // set up the items
  1885.             item_list
  1886.                 on_item "F2=OK" send copy_ok
  1887.                 on_item "Esc=Cancel" send file_copy_off
  1888.                 on_item "F1=Help" send focus_help
  1889.             end_item_list
  1890.         end_object
  1891.  
  1892.         // this activates this object
  1893.         procedure file_copy_on
  1894.             set value of (file_copy_title(current_object)) item 0 ;
  1895.                 to "Copy Files..."
  1896.             set value of (file_copy_title(current_object)) item 1 ;
  1897.                 to "Destination"
  1898.             send init_specs to (file_copy_spec(current_object))
  1899.             set focus_mode to focusable
  1900.             send activate
  1901.         end_procedure
  1902.  
  1903.         // this deactivates this object
  1904.         procedure file_copy_off
  1905.             send deactivate
  1906.             set focus_mode to no_activate
  1907.         end_procedure
  1908.  
  1909.         // this routes a message to its proper object
  1910.         procedure file_selected string thefile
  1911.             send file_selected to (file_copy_spec(current_object)) thefile
  1912.         end_procedure
  1913.  
  1914.         // this routes a message to its proper object
  1915.         procedure dir_selected string thedir
  1916.             send dir_selected to (file_copy_spec(current_object)) thedir
  1917.         end_procedure
  1918.  
  1919.         // this routes a message to its proper object, but only if all items
  1920.         // have been processed.
  1921.         procedure copy_ok
  1922.             send copy_ok to (file_copy_spec(current_object))
  1923.         end_procedure
  1924.  
  1925.         // this routes a message to its proper object
  1926.         procedure copy_it string source string destination
  1927.             send copy_it to (file_copy_spec(current_object)) source ;
  1928.                 destination
  1929.         end_procedure
  1930.  
  1931.         // class override
  1932.         // this should check for item changes first 
  1933.         // and process them if they exist.
  1934.         procedure select_all_files
  1935.             // check item changes and rebuild list(s) if necessary
  1936.             send check_changes to (file_copy_spec(current_object))
  1937.  
  1938.             // continue with original job, as per class definition
  1939.             forward send select_all_files
  1940.         end_procedure
  1941.  
  1942.         // class override
  1943.         // this should check for item changes first 
  1944.         // and process them if they exist.
  1945.         procedure deselect_all_files
  1946.             // check item changes and rebuild list(s) if necessary
  1947.             send check_changes to (file_copy_spec(current_object))
  1948.  
  1949.             // continue with original job, as per class definition
  1950.             forward send deselect_all_files
  1951.         end_procedure
  1952.     end_object
  1953.  
  1954.     //************************************************************************
  1955.     //
  1956.     //    Name: FILE_DELETE
  1957.     // Purpose: implements the delete file function
  1958.     //
  1959.     //   Notes: structurally identical to FILE_COPY
  1960.     //
  1961.     //************************************************************************
  1962.     object file_delete is a file_client file_1
  1963.         on_key ksave_record send delete_ok
  1964.         on_key kcancel send file_delete_off
  1965.  
  1966.         object file_delete_title is a title file_1_title
  1967.             set center_state item 0 to true
  1968.         end_object
  1969.  
  1970.         object file_delete_spec is a file_spec file_1_spec
  1971.             item_list
  1972.                 on_item "" send get_filelist
  1973.                 on_item "" send get_dirlist
  1974.             end_item_list
  1975.  
  1976.             procedure delete_it string source
  1977.                 erasefile source
  1978.             end_procedure
  1979.  
  1980.             procedure deleting string source
  1981.                 send working_on "Deleting:" source
  1982.                 send delete_it source
  1983.             end_procedure
  1984.  
  1985.             procedure file_selected string thefile
  1986.                 local string source
  1987.  
  1988.                 trim (value(file_delete_spec(current_object),1)) to source
  1989.                 if (right(source,1)) ne Dir_Separator append source Dir_Separator
  1990.                 append source thefile
  1991.                 send deleting source
  1992.             end_procedure
  1993.  
  1994.             procedure delete_ok
  1995.                 local string source
  1996.  
  1997.                 if (changed_state(current_object) = true) send check_changes
  1998.                 if (check_selections(current_object)) begin
  1999.                     if (verify_delete(current_object) = msg_ok) ;
  2000.                         send process_selections
  2001.                     send working_off
  2002.                     send do_filelist
  2003.                 end
  2004.                 else send nothing_to_do 'deleted.'
  2005.             end_procedure
  2006.         end_object
  2007.  
  2008.         object file_stuff is a file_list file_1_file_list
  2009.         end_object
  2010.  
  2011.         object dir_stuff is a dir_list file_1_dir_list
  2012.         end_object
  2013.  
  2014.         object file_delete_list_button is a file_list_button ;
  2015.             file_1_list_button
  2016.         end_object
  2017.  
  2018.         object file_delete_button is a button file_1_button
  2019.             set focus_mode to pointer_only
  2020.  
  2021.             item_list
  2022.                 on_item "F2=OK" send delete_ok
  2023.                 on_item "Esc=Cancel" send file_delete_off
  2024.                 on_item "F1=Help" send focus_help
  2025.             end_item_list
  2026.         end_object
  2027.  
  2028.         procedure file_delete_on
  2029.             set value of (file_delete_title(current_object)) item 0 ;
  2030.                 to "Delete Files..."
  2031.             send init_specs to (file_delete_spec(current_object))
  2032.             set focus_mode to focusable
  2033.             send activate
  2034.         end_procedure
  2035.  
  2036.         procedure file_delete_off
  2037.             send deactivate
  2038.             set focus_mode to no_activate
  2039.         end_procedure
  2040.  
  2041.         procedure file_selected string thefile
  2042.             send file_selected to (file_delete_spec(current_object)) thefile
  2043.         end_procedure
  2044.  
  2045.         procedure dir_selected string thedir
  2046.             send dir_selected to (file_delete_spec(current_object)) thedir
  2047.         end_procedure
  2048.  
  2049.         procedure delete_ok
  2050.             send delete_ok to (file_delete_spec(current_object))
  2051.         end_procedure
  2052.  
  2053.         procedure delete_it string source
  2054.             send delete_it to (file_delete_spec(current_object)) source
  2055.         end_procedure
  2056.  
  2057.         procedure select_all_files
  2058.             send check_changes to (file_delete_spec(current_object))
  2059.             forward send select_all_files
  2060.         end_procedure
  2061.  
  2062.         procedure deselect_all_files
  2063.             send check_changes to (file_delete_spec(current_object))
  2064.             forward send deselect_all_files
  2065.         end_procedure
  2066.     end_object
  2067.  
  2068.     //************************************************************************
  2069.     //
  2070.     //    Name: FILE_PRINT
  2071.     // Purpose: implements the print file function
  2072.     //
  2073.     //   Notes: structurally identical to FILE_COPY
  2074.     //
  2075.     //************************************************************************
  2076.     object file_print is a file_client file_1
  2077.         on_key ksave_record send print_ok
  2078.         on_key kcancel send file_print_off
  2079.  
  2080.         object file_print_title is a title file_1_title
  2081.             set center_state item 0 to true
  2082.         end_object
  2083.  
  2084.         object file_print_spec is a file_spec file_1_spec
  2085.             item_list
  2086.                 on_item "" send get_filelist
  2087.                 on_item "" send get_dirlist
  2088.             end_item_list
  2089.  
  2090.             procedure print_it string source
  2091.                 local string aline
  2092.  
  2093.                 direct_output "LST:"
  2094.                 direct_input source
  2095.  
  2096.                 [not seqeof] repeat
  2097.                     readln aline
  2098.                     writeln aline
  2099.                 [not seqeof] loop
  2100.  
  2101.                 close_output
  2102.                 close_input
  2103.  
  2104.                 [multiuser] despool
  2105.             end_procedure
  2106.  
  2107.             procedure printing string source
  2108.                 send working_on "Printing:" source
  2109.                 send print_it source
  2110.             end_procedure
  2111.  
  2112.             procedure file_selected string thefile
  2113.                 local string source
  2114.  
  2115.                 trim (value(file_print_spec(current_object),1)) to source
  2116.                 if (right(source,1)) ne Dir_Separator append source Dir_Separator
  2117.                 append source thefile
  2118.                 send printing source
  2119.             end_procedure
  2120.  
  2121.             procedure print_ok
  2122.                 local string source
  2123.  
  2124.                 if (changed_state(current_object) = true) send check_changes
  2125.                 if (check_selections(current_object)) begin
  2126.                     send process_selections
  2127.                     send working_off
  2128.                 end
  2129.                 else send nothing_to_do 'printed.'
  2130.             end_procedure
  2131.         end_object
  2132.  
  2133.         object file_stuff is a file_list file_1_file_list
  2134.         end_object
  2135.  
  2136.         object dir_stuff is a dir_list file_1_dir_list
  2137.         end_object
  2138.  
  2139.         object file_print_list_button is a file_list_button ;
  2140.             file_1_list_button
  2141.         end_object
  2142.  
  2143.         object file_print_button is a button file_1_button
  2144.             set focus_mode to pointer_only
  2145.  
  2146.             item_list
  2147.                 on_item "F2=OK" send print_ok
  2148.                 on_item "Esc=Cancel" send file_print_off
  2149.                 on_item "F1=Help" send focus_help
  2150.             end_item_list
  2151.         end_object
  2152.  
  2153.         procedure file_print_on
  2154.             set value of (file_print_title(current_object)) item 0 ;
  2155.                 to "Print Files..."
  2156.             send init_specs to (file_print_spec(current_object))
  2157.             set focus_mode to focusable
  2158.             send activate
  2159.         end_procedure
  2160.  
  2161.         procedure file_print_off
  2162.             send deactivate
  2163.             set focus_mode to no_activate
  2164.         end_procedure
  2165.  
  2166.         procedure file_selected string thefile
  2167.             send file_selected to (file_print_spec(current_object)) thefile
  2168.         end_procedure
  2169.  
  2170.         procedure dir_selected string thedir
  2171.             send dir_selected to (file_print_spec(current_object)) thedir
  2172.         end_procedure
  2173.  
  2174.         procedure print_ok
  2175.             send print_ok to (file_print_spec(current_object))
  2176.         end_procedure
  2177.  
  2178.         procedure print_it string source
  2179.             send print_it to (file_print_spec(current_object)) source
  2180.         end_procedure
  2181.  
  2182.         procedure select_all_files
  2183.             send check_changes to (file_print_spec(current_object))
  2184.             forward send select_all_files
  2185.         end_procedure
  2186.  
  2187.         procedure deselect_all_files
  2188.             send check_changes to (file_print_spec(current_object))
  2189.             forward send deselect_all_files
  2190.         end_procedure
  2191.     end_object
  2192.  
  2193.     //************************************************************************
  2194.     //
  2195.     //    Name: FILE_RENAME
  2196.     // Purpose: implements the rename file function
  2197.     //
  2198.     //   Notes: structurally identical to FILE_COPY
  2199.     //
  2200.     //************************************************************************
  2201.     object file_rename is a file_client file_2
  2202.         on_key ksave_record send rename_ok
  2203.         on_key kcancel send file_rename_off
  2204.  
  2205.         object file_rename_title is a title file_2_title
  2206.             set center_state item 0 to true
  2207.             set shadow_state item 1 to true
  2208.         end_object
  2209.  
  2210.         object file_rename_spec is a file_spec file_2_spec
  2211.             item_list
  2212.                 on_item "" send get_filelist
  2213.                 on_item "" send get_dirlist
  2214.                 on_item "" send next
  2215.             end_item_list
  2216.  
  2217.             procedure init_specs
  2218.                 forward send init_specs
  2219.                 set value item 2 to ""
  2220.             end_procedure
  2221.  
  2222.             procedure rename_it string source string destination
  2223.                 renamefile source to destination
  2224.             end_procedure
  2225.  
  2226.             procedure renaming string source string destination
  2227.                 if (value(current_object,2)) gt "" begin
  2228.                     send working_on "Renaming:" source
  2229.                     send rename_it source destination
  2230.                 end
  2231.                 else send spec_invalid "You have not specified" ;
  2232.                     "the new name!"
  2233.             end_procedure
  2234.  
  2235.             procedure file_selected string thefile
  2236.                 local string source destination
  2237.  
  2238.                 trim (value(file_rename_spec(current_object),1)) to source
  2239.                 if (right(source,1)) ne Dir_Separator append source Dir_Separator
  2240.                 append source thefile
  2241.                 trim (value (file_rename_spec(current_object),2)) ;
  2242.                     to destination
  2243.                 send renaming source destination
  2244.             end_procedure
  2245.  
  2246.             procedure rename_ok
  2247.                 local string source destination
  2248.  
  2249.                 if (changed_state(current_object) = true) send check_changes
  2250.                 if (check_selections(current_object)) begin
  2251.                     send process_selections
  2252.                     send working_off
  2253.                     send do_filelist
  2254.                 end
  2255.                 else send nothing_to_do 'renamed.'
  2256.             end_procedure
  2257.         end_object
  2258.  
  2259.         object file_stuff is a file_list file_2_file_list
  2260.         end_object
  2261.  
  2262.         object dir_stuff is a dir_list file_2_dir_list
  2263.         end_object
  2264.  
  2265.         object file_rename_list_button is a file_list_button ;
  2266.             file_2_list_button
  2267.         end_object
  2268.  
  2269.         object file_rename_button is a button file_2_button
  2270.             set focus_mode to pointer_only
  2271.  
  2272.             item_list
  2273.                 on_item "F2=OK" send rename_ok
  2274.                 on_item "Esc=Cancel" send file_rename_off
  2275.                 on_item "F1=Help" send focus_help
  2276.             end_item_list
  2277.         end_object
  2278.  
  2279.         procedure file_rename_on
  2280.             set value of (file_rename_title(current_object)) item 0 ;
  2281.                 to "Rename Files..."
  2282.             set value of (file_rename_title(current_object)) item 1 ;
  2283.                 to "   New name"
  2284.             send init_specs to (file_rename_spec(current_object))
  2285.             set focus_mode to focusable
  2286.             send activate
  2287.         end_procedure
  2288.  
  2289.         procedure file_rename_off
  2290.             send deactivate
  2291.             set focus_mode to no_activate
  2292.         end_procedure
  2293.  
  2294.         procedure file_selected string thefile
  2295.             send file_selected to (file_rename_spec(current_object)) thefile
  2296.         end_procedure
  2297.  
  2298.         procedure dir_selected string thedir
  2299.             send dir_selected to (file_rename_spec(current_object)) thedir
  2300.         end_procedure
  2301.  
  2302.         procedure rename_ok
  2303.             send rename_ok to (file_rename_spec(current_object))
  2304.         end_procedure
  2305.  
  2306.         procedure rename_it string source string destination
  2307.             send rename_it to (file_rename_spec(current_object)) source ;
  2308.                 destination
  2309.         end_procedure
  2310.  
  2311.         procedure select_all_files
  2312.             send check_changes to (file_rename_spec(current_object))
  2313.             forward send select_all_files
  2314.         end_procedure
  2315.  
  2316.         procedure deselect_all_files
  2317.             send check_changes to (file_rename_spec(current_object))
  2318.             forward send deselect_all_files
  2319.         end_procedure
  2320.     end_object
  2321.  
  2322.     //************************************************************************
  2323.     //
  2324.     //    Name: FILE_TYPE
  2325.     // Purpose: implements the type file function
  2326.     //
  2327.     //   Notes: structurally identical to FILE_COPY
  2328.     //
  2329.     //************************************************************************
  2330.     object file_type is a file_client file_1
  2331.         on_key ksave_record send type_ok
  2332.         on_key kcancel send file_type_off
  2333.  
  2334.         object file_type_title is a title file_1_title
  2335.             set center_state item 0 to true
  2336.         end_object
  2337.  
  2338.         object file_type_spec is a file_spec file_1_spec
  2339.             item_list
  2340.                 on_item "" send get_filelist
  2341.                 on_item "" send get_dirlist
  2342.             end_item_list
  2343.  
  2344.             procedure type_it string source
  2345.                 local string aline akey
  2346.  
  2347.                 direct_input source
  2348.                 send virtual_console_on ("Typing " + source)
  2349.                 repeat
  2350.                     readln aline
  2351.                     [not seqeof] send write_a_line aline
  2352.                 [not seqeof not interrupted] loop
  2353.                 send virtual_console_off
  2354.                 close_input
  2355.  
  2356.                 [interrupted] send deselect_all_files
  2357.             end_procedure
  2358.  
  2359.             procedure file_selected string thefile
  2360.                 local string source
  2361.  
  2362.                 trim (value(file_type_spec(current_object),1)) to source
  2363.                 if (right(source,1)) ne Dir_Separator append source Dir_Separator
  2364.                 append source thefile
  2365.                 send type_it source
  2366.             end_procedure
  2367.  
  2368.             procedure type_ok
  2369.                 local string source
  2370.  
  2371.                 if (changed_state(current_object) = true) send check_changes
  2372.                 if (check_selections(current_object)) ;
  2373.                     send process_selections
  2374.                 else send nothing_to_do 'typed.'
  2375.             end_procedure
  2376.         end_object
  2377.  
  2378.         object file_stuff is a file_list file_1_file_list
  2379.         end_object
  2380.  
  2381.         object dir_stuff is a dir_list file_1_dir_list
  2382.         end_object
  2383.  
  2384.         object file_type_list_button is a file_list_button file_1_list_button
  2385.         end_object
  2386.  
  2387.         object file_type_button is a button file_1_button
  2388.             set focus_mode to pointer_only
  2389.  
  2390.             item_list
  2391.                 on_item "F2=OK" send type_ok
  2392.                 on_item "Esc=Cancel" send file_type_off
  2393.                 on_item "F1=Help" send focus_help
  2394.             end_item_list
  2395.         end_object
  2396.  
  2397.         procedure file_type_on
  2398.             set value of (file_type_title(current_object)) item 0 ;
  2399.                 to "Type Files..."
  2400.             send init_specs to (file_type_spec(current_object))
  2401.             set focus_mode to focusable
  2402.             send activate
  2403.         end_procedure
  2404.  
  2405.         procedure file_type_off
  2406.             send deactivate
  2407.             set focus_mode to no_activate
  2408.         end_procedure
  2409.  
  2410.         procedure file_selected string thefile
  2411.             send file_selected to (file_type_spec(current_object)) thefile
  2412.         end_procedure
  2413.  
  2414.         procedure dir_selected string thedir
  2415.             send dir_selected to (file_type_spec(current_object)) thedir
  2416.         end_procedure
  2417.  
  2418.         procedure type_ok
  2419.             send type_ok to (file_type_spec(current_object))
  2420.         end_procedure
  2421.  
  2422.         procedure type_it string source
  2423.             send type_it to (file_type_spec(current_object)) source
  2424.         end_procedure
  2425.  
  2426.         procedure select_all_files
  2427.             send check_changes to (file_type_spec(current_object))
  2428.             forward send select_all_files
  2429.         end_procedure
  2430.  
  2431.         procedure deselect_all_files
  2432.             send check_changes to (file_type_spec(current_object))
  2433.             forward send deselect_all_files
  2434.         end_procedure
  2435.     end_object
  2436.  
  2437.     //************************************************************************
  2438.     //
  2439.     //    Name: WORKING
  2440.     // Purpose: implements general "working, please wait"-style message
  2441.     //
  2442.     //************************************************************************
  2443.     object working is a message
  2444.         // prevent activation as a regular child
  2445.         set focus_mode to no_activate
  2446.  
  2447.         // auto-center both item windows
  2448.         set center_state item 0 to true
  2449.         set center_state item 1 to true
  2450.  
  2451.         // set the color on both item windows to the image's background color
  2452.         set shadow_state item 0 to true
  2453.         set shadow_state item 1 to true
  2454.  
  2455.         // position it within the parent's client area
  2456.         set location to 12 15 relative
  2457.  
  2458.         // this displays what we are doing at this time
  2459.         procedure working_on string action string afile
  2460.             // allow it to become visible
  2461.             set focus_mode to focusable
  2462.  
  2463.             // put the supplied text in the item windows
  2464.             set value item 0 to action
  2465.             set value item 1 to afile
  2466.  
  2467.             // display it on the screen
  2468.             send activate
  2469.         end_procedure
  2470.  
  2471.         // this removes the object's image
  2472.         procedure working_off
  2473.             // return the focus to whoever had it before
  2474.             send deactivate
  2475.  
  2476.             // return the activation mode to the default mode
  2477.             set focus_mode to no_activate
  2478.         end_procedure
  2479.     end_object
  2480.  
  2481.     //************************************************************************
  2482.     //
  2483.     //    Name: INVALID_SPEC
  2484.     // Purpose: implements general purpose warning message
  2485.     //
  2486.     //************************************************************************
  2487.     object invalid_spec is a warning_msg
  2488.         // prevent activation as a regular child
  2489.         set focus_mode to no_activate
  2490.  
  2491.         // fancy way to center the object vertically within its parent's 
  2492.         // client area below the action bar
  2493.         set location to (((main_object.lines + 2) - invalid_spec.lines) / 2) ;
  2494.             21 relative
  2495.         // adjust for title and action bar-----^ (one line each)
  2496.  
  2497.         // auto-center both item windows
  2498.         set center_state item 0 to true
  2499.         set center_state item 1 to true
  2500.  
  2501.         // set the color on both item windows to the image's background color
  2502.         set shadow_state item 0 to true
  2503.         set shadow_state item 1 to true
  2504.  
  2505.         // this 'does' the OK button
  2506.         object invalid_spec_button is a button
  2507.             // prevent activation of any objects outside of this one
  2508.             set block_mouse_state to true
  2509.             set local_rotate_state to true
  2510.  
  2511.             // set up button item
  2512.             item_list
  2513.                 on_item "OK" send ok
  2514.             end_item_list
  2515.         end_object
  2516.  
  2517.         // this pops up the object's image with the supplied text in it
  2518.         procedure tell_em string amsg string bmsg
  2519.             local integer temp
  2520.  
  2521.             // put the text in the item windows
  2522.             set value item 0 to amsg
  2523.             set value item 1 to bmsg
  2524.  
  2525.             ui_accept (invalid_spec_button(current_object)) to temp
  2526.         end_procedure
  2527.     end_object
  2528.  
  2529.     //************************************************************************
  2530.     //
  2531.     //    Name: NOTHING_MARKED
  2532.     // Purpose: implements notification message
  2533.     //
  2534.     //************************************************************************
  2535.     object nothing_marked is a warning_msg
  2536.         // prevent activation as a regular child
  2537.         set focus_mode to no_activate
  2538.  
  2539.         // fancy way to center the object vertically within its parent's 
  2540.         // client area below the action bar
  2541.         set location to (((main_object.lines + 2) - nothing_marked.lines) / 2) ;
  2542.             21 relative
  2543.         // adjust for title and action bar-----^ (one line each)
  2544.  
  2545.         // set the color on both item windows to the image's background color
  2546.         set shadow_state item 0 to true
  2547.  
  2548.         // this 'does' the OK button
  2549.         object nothing_marked_button is a button
  2550.             // prevent activation of any objects outside of this one
  2551.             set block_mouse_state to true
  2552.             set local_rotate_state to true
  2553.  
  2554.             // set up button item
  2555.             item_list
  2556.                 on_item "OK" send ok
  2557.             end_item_list
  2558.         end_object
  2559.  
  2560.         // this pops up the object's image with the supplied text in it
  2561.         procedure tell_em string amsg
  2562.             local integer temp
  2563.  
  2564.             // put the text in the item window
  2565.             set value item 0 to amsg
  2566.  
  2567.             ui_accept (nothing_marked_button(current_object)) to temp
  2568.         end_procedure
  2569.     end_object
  2570.  
  2571.     //************************************************************************
  2572.     //
  2573.     //    Name: DELETE_CONFIRM
  2574.     // Purpose: implements deletion verification
  2575.     //
  2576.     //************************************************************************
  2577.     object delete_confirm is a warning_msg
  2578.         // prevent activation as a regular child
  2579.         set focus_mode to no_activate
  2580.  
  2581.         // fancy way to center the object vertically within its parent's 
  2582.         // client area below the action bar
  2583.         set location to (((main_object.lines + 2) - delete_confirm.lines) / 2) ;
  2584.             21 relative
  2585.         // adjust for title and action bar-----^ (one line each)
  2586.  
  2587.         // this 'does' the OK button
  2588.         object delete_confirm_button is a button
  2589.             // prevent activation of any objects outside of this one
  2590.             set block_mouse_state to true
  2591.             set local_rotate_state to true
  2592.  
  2593.             on_key knext_item send swap
  2594.             on_key kprevious_item send swap
  2595.  
  2596.             // set up button item
  2597.             item_list
  2598.                 on_item "OK" send ok
  2599.                 on_item "Cancel" send cancel
  2600.             end_item_list
  2601.  
  2602.             procedure swap
  2603.                 local integer item#
  2604.                 get current_item to item#
  2605.                 set current_item to (1 - item#)
  2606.             end_procedure
  2607.  
  2608.             procedure activating
  2609.                 set current_item to 1
  2610.                 forward send activating
  2611.             end_procedure
  2612.         end_object
  2613.  
  2614.         function verify_delete returns integer
  2615.             local integer retval
  2616.  
  2617.             set focus_mode to focusable
  2618.             ui_accept (delete_confirm_button(current_object)) to retval
  2619.             set focus_mode to no_activate
  2620.  
  2621.             function_return retval
  2622.         end_function
  2623.     end_object
  2624.  
  2625.     // this routes a message to its proper object
  2626.     procedure do_action_bar
  2627.         send activate to (main_action_bar(current_object))
  2628.     end_procedure
  2629.  
  2630.     // this routes a message to its proper object
  2631.     procedure display_title
  2632.         send display_title to (menu_head(current_object))
  2633.     end_procedure
  2634.  
  2635.     // this routes a message to its proper object and returns the result
  2636.     // to the caller
  2637.     function ask_question integer qnum returns integer
  2638.         function_return (ask_question(question(current_object),qnum))
  2639.     end_function
  2640.  
  2641.     // this routes a message to its proper object and returns the result
  2642.     // to the caller
  2643.     function validate string option_password returns integer
  2644.         function_return (validate(password(current_object),option_password))
  2645.     end_function
  2646.  
  2647.     // this routes a message to its proper object and returns the result
  2648.     // to the caller
  2649.     function reply returns string
  2650.         function_return (reply(question(current_object)))
  2651.     end_function
  2652.  
  2653.     // this routes a message to its proper object
  2654.     procedure run string theprogram
  2655.         send run to (run_stuff(current_object)) theprogram
  2656.     end_procedure
  2657.  
  2658.     // this routes a message to its proper object
  2659.     procedure do_chain
  2660.         send chain_stuff_on to (chain_stuff(current_object))
  2661.     end_procedure
  2662.  
  2663.     // this routes a message to its proper object
  2664.     procedure do_run
  2665.         send run_stuff_on to (run_stuff(current_object))
  2666.     end_procedure
  2667.  
  2668.     // this routes a message to its proper object
  2669.     procedure do_copy
  2670.         send file_copy_on to (file_copy(current_object))
  2671.     end_procedure
  2672.  
  2673.     // this routes a message to its proper object
  2674.     procedure copy_it string source string destination
  2675.         send copy_it to (file_copy(current_object)) source destination
  2676.     end_procedure
  2677.  
  2678.     // this routes a message to its proper object
  2679.     procedure do_delete
  2680.         send file_delete_on to (file_delete(current_object))
  2681.     end_procedure
  2682.  
  2683.     // this routes a message to its proper object
  2684.     procedure delete_it string source
  2685.         send delete_it to (file_delete(current_object)) source
  2686.     end_procedure
  2687.  
  2688.     // this routes a message to its proper object
  2689.     procedure do_print
  2690.         send file_print_on to (file_print(current_object))
  2691.     end_procedure
  2692.  
  2693.     // this routes a message to its proper object
  2694.     procedure do_rename
  2695.         send file_rename_on to (file_rename(current_object))
  2696.     end_procedure
  2697.  
  2698.     // this routes a message to its proper object
  2699.     procedure rename_it string source string destination
  2700.         send rename_it to (file_rename(current_object)) source destination
  2701.     end_procedure
  2702.  
  2703.     // this routes a message to its proper object
  2704.     procedure do_type
  2705.         send file_type_on to (file_type(current_object))
  2706.     end_procedure
  2707.  
  2708.     // this routes a message to its proper object
  2709.     procedure type_it string source
  2710.         send type_it to (file_type(current_object)) source
  2711.     end_procedure
  2712.  
  2713.     // this routes a message to its proper object
  2714.     procedure do_os
  2715.         send run_shell to (run_stuff(current_object))
  2716.     end_procedure
  2717.  
  2718.     // this terminates the menu program
  2719.     procedure quit
  2720.         move -1 to next_menu
  2721.         send exit_application
  2722.     end_procedure
  2723.  
  2724.     // Override the exit_application message and forward.
  2725.     procedure exit_application for DESKTOP
  2726.         move -1 to next_menu
  2727.         system
  2728.     end_procedure
  2729.  
  2730.     // this routes a message to its proper object
  2731.     procedure working_on string action string afile
  2732.         send working_on to (working(current_object)) action afile
  2733.     end_procedure
  2734.  
  2735.     // this routes a message to its proper object
  2736.     procedure working_off
  2737.         send working_off to (working(current_object))
  2738.     end_procedure
  2739.  
  2740.     // this amends the supplied path with the supplied directory name
  2741.     // and returns the result
  2742.     function add_path string path string newdir returns string
  2743.         local integer slash colon
  2744.  
  2745.         // go to parent directory
  2746.         if newdir eq ".." begin
  2747.             // find out if there is a drive spec in the path
  2748.             pos ':' in path to colon
  2749.  
  2750.             // scan for backslash from right to left, but not past the colon
  2751.             // (if any) or past the beginning of the string
  2752.             length path to slash
  2753.             while ((slash > colon) and (mid(path,1,slash) <> Dir_Separator))
  2754.                 decrement slash
  2755.             end
  2756.  
  2757.             // if a backslash is found, then trim it and everything to the
  2758.             // right of it off
  2759.             if (slash > colon) left path to path (slash - 1)
  2760.         end
  2761.  
  2762.         // go to subdirectory
  2763.         else begin
  2764.             // append a backslash if needed
  2765.             if (right(path,1)) ne Dir_Separator append path Dir_Separator
  2766.  
  2767.             // append the subdirectory name
  2768.             append path newdir
  2769.         end
  2770.  
  2771.         // return the result to the caller
  2772.         function_return path
  2773.     end_function
  2774.  
  2775.     // this checks if a supplied DataFlex program file can be found
  2776.     // in dfpath
  2777.     function check_flx string cmdtail returns integer
  2778.         local string action something
  2779.         local integer space
  2780.  
  2781.         // trim the program name from the arguments (if any)
  2782.         pos ' ' in cmdtail to space
  2783.         if space trim (left(cmdtail,(space - 1))) to action
  2784.         else trim cmdtail to action
  2785.  
  2786.         // add the proper extension
  2787.         append action ".flx"
  2788.  
  2789.         // open it
  2790.         direct_input action
  2791.  
  2792.         // see if we can read from it
  2793.         readln something
  2794.  
  2795.         // all go if read succeeded
  2796.         indicate go as [not seqeof]
  2797.  
  2798.         // close it
  2799.         close_input
  2800.  
  2801.         // the file does not exist (the read failed)
  2802.         [not go] begin
  2803.             // make message text
  2804.             insert "The program file " in action at 1
  2805.  
  2806.             // and have it displayed
  2807.             send spec_invalid action "could not be located!"
  2808.  
  2809.             // return failure to caller
  2810.             function_return 0
  2811.         end
  2812.  
  2813.         // return success to caller
  2814.         [go] function_return 1
  2815.     end_procedure
  2816.  
  2817.     // these route messages to their proper objects
  2818.     procedure spec_invalid string amsg string bmsg
  2819.         send tell_em to (invalid_spec(current_object)) amsg bmsg
  2820.     end_procedure
  2821.  
  2822.     procedure nothing_to_do string amsg
  2823.         send tell_em to (nothing_marked(current_object)) amsg
  2824.     end_procedure
  2825.  
  2826.     function verify_delete returns integer
  2827.         function_return (verify_delete(delete_confirm(current_object)))
  2828.     end_function
  2829.  
  2830.     procedure back_one
  2831.         send back_one to (menu_body(current_object))
  2832.     end_procedure
  2833.  
  2834.     procedure pull_down_file
  2835.         send pull_down_file to (main_action_bar(current_object))
  2836.     end_procedure
  2837.  
  2838.     procedure pull_down_run
  2839.         send pull_down_run to (main_action_bar(current_object))
  2840.     end_procedure
  2841.  
  2842.     procedure pull_down_help
  2843.         send pull_down_help to (main_action_bar(current_object))
  2844.     end_procedure
  2845. end_object
  2846.  
  2847. object dummy_console_title is a message
  2848.     set focus_mode to no_activate
  2849.     set center_state item 0 to true
  2850.     set value item 0 to ""
  2851.     set location to 1 1 absolute
  2852.  
  2853.     procedure dummy_title_on string atitle
  2854.         set value item 0 to atitle
  2855.         set focus_mode to focusable
  2856.         send activate
  2857.     end_procedure
  2858.  
  2859.     procedure dummy_title_off
  2860.         send deactivate
  2861.         set focus_mode to no_activate
  2862.     end_procedure
  2863. end_object
  2864.  
  2865. // this is our virtual console (see the class definition above)
  2866. object dummy_console is a vconsole
  2867.     // make it look like a monochrome screen
  2868.     set object_color to 7 7
  2869.  
  2870.     // position it within its parent (the desktop)
  2871.     set location to 2 1 absolute
  2872.  
  2873.     // set its size in rows and columns
  2874.     set size to 21 78
  2875.  
  2876.     // this initializes the virtual console
  2877.     procedure dummy_on
  2878.         // wipe it clean
  2879.         send delete_data
  2880.  
  2881.         // turn it on
  2882.         send virtual_console
  2883.  
  2884.         // give it the focus
  2885.         send activate
  2886.     end_procedure
  2887.  
  2888.     // this terminates the virtual console
  2889.     procedure dummy_off
  2890.         // acknowledge the abort request
  2891.         [interrupted] show "Interrupted, "
  2892.  
  2893.         // if not aborted, then complete the last screenfull
  2894.         [not interrupted] while ( Hi( Position( Current_Object ))) lt 20
  2895.             showln
  2896.         end
  2897.  
  2898.         // ready to go back
  2899.         show "Press Any Key To Return..."
  2900.         inkey termchar
  2901.  
  2902.         // give the virtual console back to the desktop
  2903.         send virtual_console to desktop
  2904.  
  2905.         // remove the focus
  2906.         send deactivate
  2907.     end_procedure
  2908.  
  2909.     // this writes a string, followed by a newline
  2910.     procedure write_one string aline
  2911.         // write the string
  2912.         showln aline
  2913.  
  2914.         // assume no user interrupt
  2915.         indicate interrupted false
  2916.  
  2917.         // check if screen is full
  2918.         if ( Hi( Position( Current_Object ))) ge 20 begin
  2919.             // let the user read the screen
  2920.             show "Press [Esc] To Stop, Other Key To Continue..."
  2921.             inkey aline
  2922.             clearscreen
  2923.  
  2924.             // did the user interrupt?
  2925.             indicate interrupted as [key.escape]
  2926.         end
  2927.         else begin // screen is filling
  2928.             // check for a user interrupt
  2929.             keycheck
  2930.             indicate interrupted as [keypress]
  2931.         end
  2932.     end_procedure
  2933. end_object
  2934.  
  2935. procedure virtual_console_on string atitle
  2936.     send dummy_title_on to (dummy_console_title(current_object)) atitle
  2937.     send dummy_on to (dummy_console(current_object))
  2938. end_procedure
  2939.  
  2940. // this routes a message to its proper object
  2941. procedure virtual_console_off
  2942.     send dummy_off to (dummy_console(current_object))
  2943.     send dummy_title_off to (dummy_console_title(current_object))
  2944. end_procedure
  2945.  
  2946. // this routes a message to its proper object
  2947. procedure write_a_line string aline
  2948.     send write_one to (dummy_console(current_object)) aline
  2949. end_procedure
  2950.  
  2951. // this is where we start
  2952. move (next_menu max 1) to next_menu
  2953.  
  2954. // start the user interface at the main object
  2955. start_ui main_object
  2956.  
  2957. // clear the screen
  2958. clearscreen
  2959.  
  2960. // bye bye
  2961. system
  2962.