home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 236 / 236.d81 / t.dbdocs4 < prev    next >
Text File  |  2022-08-26  |  14KB  |  515 lines

  1. u
  2.         DOTBASIC DOCUMENTATION
  3.                 Part 5
  4.  
  5.    And now the exciting conclusion!
  6.  
  7.  
  8.   GET DIRECTORY:
  9.   .B$,"$:*",dv,loc,# filenames
  10.   ----------------------------
  11.  
  12.     This will read the disk directory
  13. from device DV. The directory can be
  14. placed anywhere, even under I/O.
  15. MM2.1 converts the directory to an
  16. EDSTAR file as it's brought in. This
  17. allows SCROLLING MENU to use the
  18. information as a file requestor.
  19.  
  20.     Normally you would use "$:*" to
  21. get all the disk's filenames. You can
  22. replace "$:*" with any search pattern
  23. you want, up to 16 characters long.
  24. For example, using "$:b.*,t.*" on a
  25. LOADSTAR disk would bring in the
  26. names of all the boot and text files.
  27. (This works on VICE only if True Drive
  28. is enabled.)
  29.  
  30.     E$ will return the error message.
  31. T$ will contain the disk's name
  32. within quotes, and B$ will contain
  33. the "blocks free" message. Use
  34. VAL(B$) to extract the number of
  35. blocks free on the disk. N% returns
  36. the number of filenames loaded.
  37.  
  38.     If there was an error during the
  39. directory getting, T$ and B$ will
  40. return strings full of spaces, and E$
  41. will tell about the error. The one
  42. thing your program should do before
  43. disk access is check if the drive is
  44. actually online, like this:
  45.  
  46.    1000 close2:open2,dv,2:close2
  47.    1010 if st=-128 then...
  48.    1020 ...continue
  49.  
  50.     Line 1010 would go and deal with
  51. a "device not present" situation. If
  52. all is well, line 1020 executes and
  53. disk access occurs.
  54.  
  55.     GET DIRECTORY has been greatly
  56. improved with the addition of one
  57. more parameter: how many filenames
  58. you have room to hold. This number
  59. should be calculated as:
  60.  
  61.    # files = INT((bufferspace-1)/32)
  62.  
  63.     For example, if your buffer was
  64. from 49152 to 53248, you could fit
  65. INT((4096-1)/32) = 127 names there.
  66. This formula takes into account the
  67. zero cap and the three bytes per line
  68. that the racking process needs.
  69.  
  70.     If the buffer space is filled up
  71. before all the filenames are loaded,
  72. B$ will return "more files on disk".
  73. If you don't care about buffer space,
  74. use 0 for the number of filenames.
  75.  
  76.  
  77.  SCROLLING MENU:
  78.  .ML,<area>,bx,ic,u,h,lc,t$,b$
  79.  -----------------------------
  80.  
  81.     The <area> represents the x1,x2,
  82. y1,y2 parameters so common to
  83. DotBASIC. (In your code, replace
  84. <area> with the x1,x2,y1,y2
  85. parameters.)
  86.  
  87.     The x1,x2,y1,y2 parameters set the
  88. area the menu will occupy on the
  89. screen, which must be at least 7
  90. characters tall and 11 wide. BX -
  91. Color for the box around the Scrolling
  92. Menu. IC - Color for the "icons" --
  93. UP, DOWN, HOME, QUIT. U is the color
  94. of the unhighlighted items of the
  95. menu. H is the highlight bar color. If
  96. you don't want the text to reverse or
  97. un-reverse as the bar moves, add 128
  98. to H.
  99.  
  100.     Left-click on UP or DOWN icons to
  101. scroll the text. Right-click on them
  102. and the list jumps a page at a time.
  103. The user can use the CRSR keys to
  104. scroll or page through the text as
  105. well.
  106.  
  107.     Clicking on HOME icon will bring
  108. the list to the top. Pressing the
  109. HOME key will bring the highlight bar
  110. to the top of the page, and the next
  111. press brings the list to the top.
  112.  
  113.     Click on an item or press RETURN
  114. to select it. The entire item is
  115. returned in W$. F$ will return a null
  116. unless this is a file requestor --
  117. when it will contain the filename. SL%
  118. returns the selection number.
  119.  
  120.     Clicking on QUIT icon, pressing
  121. Q, or pressing the Global Escape key
  122. will return zero in SL% and nulls in
  123. W$ and F$.
  124.  
  125.     LC is the location of the EDSTAR
  126. file, which can be anywhere in
  127. memory. The file will be "racked up"
  128. before use, which can take up to a
  129. second (gasp!) on 1 MHz machines.
  130. When LC=0, the text file will not be
  131. racked up again -- like when you have
  132. sorted the data. This is better served
  133. for the multi-select menu, if you
  134. wanted to re-enter the menu without
  135. zeroing the "selected" flags. (Read
  136. on!)
  137.  
  138.     T$ is printed at the menu's top,
  139. in reverse, between HOME and UP. B$
  140. is printed at the bottom, between
  141. QUIT and DOWN. You needn't use the
  142. actual variables T$ and B$, but if
  143. this is going to be a file requestor,
  144. it's perfect. The user gets to see
  145. the disk name and blocks free without
  146. any extra effort from you.!
  147.  
  148.     Set X2 to 255 and the proper
  149. width for a file requestor will be
  150. assigned, but that's it. DotBASIC
  151. knows what filename info looks like
  152. and will set F$ properly when it finds
  153. a filename - regardless of width.
  154.  
  155.     NOTE: Using the SCROLLING MENU
  156. with LC not equal to zero changes what
  157. the INDEX routine is cued up to read.
  158. That is, if LC>0 then the data is
  159. Racked.
  160.  
  161.      An alternate use of LC=0 is, for
  162. example, in a puzzle game. You could
  163. BLOAD WITH ZERO the instructions,
  164. RACK it up right away, and then just
  165. use 0 for LC in the scrolling menu.
  166. The HELP text would pop up quickly,
  167. every time the user needed it.
  168.  
  169.  
  170. BUILD YOUR OWN SCROLLING MENUS
  171. -------------------------------
  172.  
  173.      X1+128 is a powerful new
  174. feature. If you do not like the
  175. generic look of the scrolling menu,
  176. you can now do something about it!
  177.  
  178.      Several things DON'T happen when
  179. x1+128 is used. The bx,ic,t$, and b$
  180. parameters are IGNORED. The scrolling
  181. menu box is NOT drawn. The previouse
  182. CAGE remains the same. The x1,x2,y1,
  183. y2 parameters now represent the area
  184. for the ACTUAL scrolling text alone.
  185.  
  186.      "Manual Icons" is just that.
  187. MR.MOUSE is trusting YOU to create,
  188. label, and enable (as regions) the
  189. icons for your scrolling menu. They
  190. can be any size and at any location.
  191.  
  192.      Since you may not always label
  193. the EXIT icon as "Quit", MV+16 exists
  194. so you can assign an appropriate key
  195. to the exit function. The CRSR keys
  196. still scroll and page, and HOME still
  197. goes home. ESCAPE cancels, just like
  198. EXIT (in the regular scrolling menu).
  199.  
  200.     For SCROLLING MENU to work, you
  201. must have a RACKED EDSTAR file in
  202. memory, and it must end with a zero
  203. byte. If STAR LINKER is used to place
  204. prepared lists into memory, you will
  205. need to append a zero to each text
  206. file with an ML monitor. (Or use
  207. Mr.Edstar -- which includes the 0 at
  208. the end of the file.)
  209.  
  210.  
  211.   MORE ABOUT INDEXING
  212.   -------------------
  213.  
  214.     When a file is RACKed up by
  215. yourself or a scrolling menu,
  216. MV+24/25 reveal the location of the
  217. text's newly generated pointers. The
  218. number of items in the current
  219. INDEXable file is at MV+26/27. These
  220. two variables, which used to be kept
  221. internally, are now at the disposal
  222. of the advanced programmer.
  223.  
  224.     By preserving and later restoring
  225. MV+24-27, it is possible to have two
  226. or more INDEXable files in memory at
  227. once, without having to RACK them
  228. (taking almost a second) just so you
  229. can switch between them.
  230.  
  231.     RACKing also would wipe out all
  232. the "selected" flags stored as bit 7
  233. of each item's LENGTH value. You may
  234. want to preseve MV+24-27 before
  235. calling another scrolling menu so you
  236. do not lose these flags. POKE the
  237. saved values back into MV+24-27 when
  238. it's time to INDEX SELECTED ITEMs.
  239.  
  240. [NOTE:] Remember, with DotBASIC, you
  241. can Get and Put two-byte values in
  242. memory with single commands. If you
  243. want to preserve the above locations
  244. in I1 and I2, then
  245.  
  246.    .G2,MV+24,I1:.G2,MV+26,I2
  247.  
  248. To replace the values
  249.  
  250.    .P2,MV+24,I1:.P2,MV+26,I2
  251.  
  252. Simple, eh? DMM
  253.  
  254.  
  255.     Yes sir. We have multi-selectable
  256. scrolling menus now! But first, let's
  257. examine the regular SCROLLING MENU:
  258.  
  259.  
  260.   MULTI-SELECT SCROLL MENU
  261.   .MV,area,b,i,u,h,s,w,l,t$,b$
  262.   ----------------------------
  263.  
  264.   area - use x1,x2,y1,y2 in your code
  265.   b    - box color
  266.   i    - icon collor
  267.   u    - unhighlighted color
  268.   h    - highlighted color
  269.   s    - selected color
  270.   w    - selected With bar
  271.   l    - location of file
  272.   t$   - top string
  273.   b$   - bottom string
  274.  
  275.     It's always easy to spot the
  276. selected items, even when they are
  277. under the highlight bar. Which of the
  278. u,h,s,w items are REVERSED is set
  279. from bits 3-0 to MV+15. By default,
  280. the highlight bar and all selected
  281. items are reversed. Each reverse bit
  282. can be temporarily disobeyed by
  283. adding 128 to the u,h,s,w parameters.
  284.  
  285.     Selecting items is as easy as
  286. hitting RETURN or clicking on them.
  287. The item is toggled and the mouse and
  288. highlight bar are moved down to the
  289. next item, scrolling when necessary -
  290. even when selecting with the mouse!
  291.  
  292.     The additional keys A, N, and T
  293. function within multi-select menus to
  294. select ALL, NONE, and to TOGGLE ALL
  295. items (respectively). The mouse user
  296. cannot access these special f