home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 236 / 236.d81 / t.dbdocs2 < prev    next >
Encoding:
Text File  |  2004-01-01  |  11.2 KB  |  432 lines

  1. u
  2.         DOTBASIC DOCUMENTATION
  3.                 Part 3
  4.  
  5.  
  6.     Welcome back! Let's get on with
  7. screen manipulation:
  8.  
  9.  
  10.   CUT:   .TC,x1,x2,y1,y2,loc
  11.   PASTE: .TP,x1,x2,y1,y2,loc
  12.   --------------------------
  13.  
  14.     CUT and PASTE are able to stash
  15. and restore any size portion of the
  16. screen to or from any location, even
  17. under I/O.
  18.  
  19.     The data is stored sequentially in
  20. memory with each cell's screen code
  21. and color code stored one after
  22. another. This formula reveals how much
  23. memory is consumed by CUT:
  24.  
  25.    bytes = (x2-x1+1)*(y2-y1+1)*2
  26.  
  27.     PASTE requires that you specify
  28. the area to be filled. As long as you
  29. use the same SIZE area as the cut
  30. data, you can PASTE it wherever you
  31. want, oodles of times.
  32.  
  33.  
  34. NOTE: DotBASIC has a better way! PASTE
  35. requires that the dimensions of the
  36. PASTEd "object" are the same as the
  37. CUT. This can be a hassle!
  38.  
  39.     So we have added OBJECT commands.
  40.  
  41.     First off, you must assign a
  42. location in memory for your objects.
  43. As with CUT and PASTE, the location
  44. can be anywhere, even under I/O.
  45.  
  46.  
  47.   OBJECT SET: .OS,location
  48.   ------------------------
  49.  
  50.     This sets a place for NEW ojects
  51. and zeros the number of objects
  52. present.
  53.  
  54.  
  55.   OBJECT LINK: .OL,location
  56.   -------------------------
  57.  
  58.     This links the Object commands to
  59. a location in memory without zeroing
  60. the number of objects present --
  61. perfect when you BLOAD an Object File.
  62.  
  63.  
  64.   OBJECT CUT: .OC,x1,x2,y1,y2
  65.   ---------------------------
  66.  
  67.     The cut object is placed in the
  68. next slot in the object area. The
  69. end+1 of the object area is returned
  70. in FP (for checking memory and
  71. BSAVEing).
  72.  
  73.  
  74.   OBJECT PASTE: .OP,index,x,y
  75.   ---------------------------
  76.  
  77.     This puts the indexed object on
  78. the screen, with x/y being the
  79. position of the upper left corner.
  80.  
  81.  
  82.   OBJECT DELETE: .OD
  83.   ------------------
  84.  
  85.     This removes the last object.
  86.  
  87.  
  88.   OBJECT NUMBER: O#
  89.   -----------------
  90.  
  91.     Returns the number of objects in
  92. the collection in I%.
  93.  
  94.  
  95.  
  96.   CHECK KEYPRESS: .KP,string
  97.   --------------------------
  98.  
  99.     This routine quickly scans your
  100. string and checks if any of those keys
  101. are being pressed at the moment. If
  102. one is, that key's position within the
  103. string will be returned in I%.
  104.  
  105.    Example: SYS ML+60,"dragon"
  106.  
  107.      If an "a" was being pressed, I%
  108. would return a value of 3. If no keys
  109. were being pressed, I% returns zero.
  110. Although the CRSR/RETURN keys already
  111. offer a means of "keyboard support",
  112. do not forget to add the convenience
  113. of hotkeys to your program!
  114.  
  115.   BIG NOTE: Some mouse buttons are
  116. mistaken for keyboard presses!
  117.  
  118.   Mouse   Usually  Can also be
  119.   Button  Seen as  Mistaken for
  120.   ------  -------  ------------
  121.   Left     SPACE   <RShift> .MBCZ <F1>
  122.   Right   nothing  \+97531 <Delete>
  123.   Middle  b.arrow  *PIYRW <Return>
  124.  
  125.  
  126.   LET GO: .KR
  127.   -----------
  128.  
  129.     This command will wait until the
  130. user is not holding either of the
  131. mouse buttons (or their equivalents)
  132. down, even if it takes all day.
  133.  
  134.  
  135.   COPYMEM:(,start,end+1,destination)
  136.   ----------------------------------
  137.    COPY MEM:          .CP,params
  138.    SWAP MEM:          .SW,params
  139.    COPY I/O INTACT:   .CI,params
  140.    COPY CHR EXPOSED:  .CC,params
  141.  
  142.     COPY MEM is the classic command.
  143. All ROMS are lifted and a raw memory
  144. transfer is performed. The speed:
  145. approximately 28 cycles per byte.
  146.  
  147.     SWAP MEM will swap the area of
  148. memory with that at the destination,
  149. at a rate of 41 cycles per byte.
  150.  
  151.     COPY I/O INTACT will lift the
  152. ROMS, but leave the $d000 area alone.
  153. This would be useful in copying the
  154. color RAM or the VIC-chip's settings.
  155.  
  156.     COPY CHAR EXPOSED will lift the
  157. ROMS, but expose the Character-ROM in
  158. the $d000 area so you can copy it.
  159.  
  160.     These routines all work under the
  161. protection of a SEI. When done, all
  162. ROMS are switched back in regardless
  163. of what location 1 held when called.
  164. In fact, this goes for all routines
  165. that switch out the ROMS.
  166.  
  167. [Note:] Routines that operate under
  168. an SEI and may take over 1/60 of a
  169. second to complete, like STASH and
  170. COPYMEM, take a short break every so
  171. often to let the interrupt "pass by".
  172. While this isn't really important, it
  173. does keep the mouse moving fluidly
  174. even during large memory transfers.
  175.  
  176.  
  177.   REGULAR MENU:
  178.   .MU,x1,x2,y1,y2,u,h,"hotkeys"
  179.   -----------------------------
  180.  
  181.     This command creates a highlight
  182. bar that moves in sync with the mouse
  183. pointer, until a selection is made.
  184. When an item is clicked on, SL% will
  185. return that "selection" number, which
  186. will be anywhere from 1 to 25.
  187.  
  188.     U is the color of unhighlighted
  189. items in the menu. The highlight bar
  190. is colored H. If you do not want the
  191. text to reverse or un-reverse as the
  192. bar moves, add 128 to H.
  193.  
  194.     You can also use the CRSR/RETURN
  195. keys instead of a mouse or joystick.
  196. In order to provide a more natural
  197. menu interface, the "Keyboard Enable"
  198. variable at MV+20 is temporarily
  199. zeroed during menus. The CRSR keys are
  200. then read manually to move the
  201. highlight bar, one move per press,
  202. like we're all used to.
  203.  
  204.     The HOTKEY string allows direct
  205. selection of menu items. For example,
  206. if you have hotkeys of "loadst*r", and
  207. the user presses "d", the fourth item
  208. is selected and the highlight bar is
  209. moved there. If there was no such
  210. item, SL% still returns a 4 but the
  211. highlight bar would not change.
  212.  
  213.     MENUS can have "regions active"
  214. without the need to POKE to MV+10 or
  215. MV+11. Clicking on an active region
  216. from a menu will return the region
  217. number (plus 128) in SL%. The HOTKEYS
  218. would return "region-like" values.
  219.  
  220.     The H+64 feature of menus will
  221. only work if "honor hotkey colors" is
  222. enabled. A HOTKEY COLOR is just ANY
  223. color within the text of a menu which
  224. is neither the highlight nor
  225. un-highlight color. That leaves you
  226. with 14 colors to make your menu's
  227. hotkeys stand out, and stay that way.
  228.  
  229.    Related Variables:     (& defaults)
  230.  
  231.   MV+10  Menu Type            (192)
  232.   MV+12  Global Escape          (0)
  233.  
  234.     MV+12 holds the ASCII code for
  235. what you'd like to designate as the
  236. escape key for ALL your menus. SL%
  237. returns a zero when the escape key is
  238. pressed, except in one instance...
  239.  
  240.     MV+10 dictates how your regular
  241. menus will behave. Each bit stands for
  242. a specific menu feature. Just add up
  243. the values for the features you want
  244. and POKE that number to MV+10.
  245.  
  246.    +128  Automatic Caging of Mouse
  247.    + 64  Automatic Point-to-First
  248.    + 32  Must Select
  249.    + 16  Escape Equal-to-Last
  250.    +  8  Honor Hotkey Colors
  251.    +  4  Dual Response
  252.    +  2  Un-highlight after Select
  253.    +  1  Stray-to-Exit
  254.  
  255.   +128 causes the mouse to be confined
  256.     within the menu's borders. After a
  257.     selection is made, the previous
  258.     cage is restored. If auto-caging
  259.     is not enabled, the user may be
  260.     able to click on the area outside
  261.     of the menu, which would return
  262.     zero in SL% (unless it is an
  263.     active region).
  264.  
  265.   +64 causes the mouse to be put at
  266.     the rightmost cell of the first
  267.     item the instant a regular menu is
  268.     called.
  269.  
  270.   +32 causes nothing to happen if the
  271.     user clicks on the area outside of
  272.     the menu. The menu remains active
  273.     as it waits for a real selection.
  274.  
  275.   +16 causes the escape key, when
  276.     pressed, to automatically select
  277.     the last item in your menu - just
  278.     as if you pressed its hotkey. This
  279.     saves some code if "Close this
  280.     Menu" is the last item in your
  281.     menus - especially when using the
  282.     ON GOTO command.
  283.  
  284.   +8 causes the highlight bar to not
  285.     change the colors of characters
  286.     that have neither the Highlight
  287.     nor Un-highlight color applied to
  288.     them.
  289.  
  290.     This is an interesting way to
  291.     inform users of your menu's
  292.     hotkeys. To use this feature
  293.     properly, you must make sure the
  294.     entire menu area is colored in the
  295.     Un-hilight color, except for the
  296.     hotkey-characters.
  297.  
  298.     Merely PRINTing your menu items
  299.     and calling the menu won't work
  300.     right on older versions of the
  301.     KERNAL. The areas on the right
  302.     sides of your items might be
  303.     colored white, or have the cursor
  304.     color or background color applied
  305.     to them. It's best to use BOX to
  306.     draw a rectangle of spaces, THEN
  307.     print your menu items.
  308.  
  309.   +2 causes the highlight bar to be
  310.     removed after a selection is made.
  311.  
  312.   +1 causes the menu to be aborted if
  313.     the mouse strays from the menu
  314.     area. SL% is returned as zero if
  315.     this happens.
  316.  
  317.  
  318.   TEXT INPUT:
  319.   .IN,x,y,t,c,length,default$
  320.   ---------------------------
  321.  
  322.     When called, the default string is
  323. printed at X,Y followed by a blinking
  324. cursor. The user can CRSR through the
  325. text, INSERT, DELETE, HOME, or CLR at
  326. will. Most normal characters are
  327. allowed, except for those fearsome
  328. quotation marks. The string is
  329. returned in W$.
  330.  
  331.     T is the text color and C is the
  332. cursor color. LENGTH is the maximum
  333. number of characters allowed, which
  334. cannot and will not exceed 80. The
  335. default string will be cut short if it
  336. exceeds the allowed LENGTH.
  337.  
  338.     A nice thing about this INPUT is
  339. that it automatically clears out the
  340. space it needs, which is handy for
  341. inputting over fields that might
  342. contain old data.
  343.  
  344.     If you want to input in REVERSE,
  345. add 128 to X. If you want to allow
  346. only numbers to be entered, add 128 to
  347. Y. If you want to allow numbers AND
  348. the decimal and minus symbols, add 192
  349. to Y.
  350.  
  351.     The Keyboard Enable variable at
  352. MV+20 is temporarily zeroed during the
  353. INPUT routine. It looks silly if the
  354. arrow pointer moves back and forth as
  355. you are CRSRing through the text.
  356.  
  357.     The Enhanced version (below) now
  358. also returns the cursor position (upon
  359. exit) in C%.
  360.  
  361.  
  362.   ENHANCED INPUT:
  363.   .IE,x,y,t,c,len,s,out$,def$
  364.   ---------------------------
  365.  
  366.     Just like REGULAR INPUT, the
  367. default string is printed at X,Y. T is
  368. the text color and C is the cursor
  369. color. L is the maximum length
  370. allowed, which can not and will not
  371. exceed 80. The user can CRSR through
  372. the text, HOME, CLR, INSERT, and
  373. DELETE at will.
  374.  
  375.     If you want to input in REVERSE,
  376. add 128 to X. If you want to allow
  377. only numbers to be entered, add 128 to
  378. Y. If you want to allow numbers AND
  379. the decimal and minus symbols, add 192
  380. to Y.
  381.  
  382.     S is the STARTing location of the
  383. blinking cursor. For example, if S was
  384. 7, then the cursor would pop up over
  385. the 8th character of the default
  386. string. Why not the 7th? Well, zero is
  387. used to represent the leftmost (1st)
  388. character. If you positioned your
  389. INPUT against the left border, you'd
  390. see that S corresponds to the usual
  391. 0-39 Cell-X values.
  392.  
  393.     If S exceeds the length of the
  394. default string, the cursor would pop
  395. up right after the end of the default
  396. string. Since this string can never
  397. exceed 80 characters, any S value
  398. above 80 ensures the cursor will start
  399. off at its "normal" position at the
  400. end of the default string.
  401.  
  402.     OUT$ allows you to specify extra
  403. keys you want to act like RETURN. For
  404. example, you might have a list of
  405. figures and would like to be able to
  406. use CRSR UP/DOWN to move through each
  407. one, and then press F1 to signify when
  408. you're done altering the lot.
  409.  
  410.     The string is returned in W$. I%
  411. tells you WHICH exit-key was pressed.
  412. It is zero when RETURN is used, and
  413. any other value means that specific
  414. key from OUT$ was pressed to exit.
  415.  
  416.     Since the incoming keypresses are
  417. checked against OUT$ first, you could
  418. use CRSR LEFT, RIGHT, HOME, or ANY key
  419. to act as a special RETURN key. Of
  420. course, using LEFT and RIGHT as exit
  421. keys means they couldn't be used to
  422. move the blinking cursor within the
  423. current line of input. However, if you
  424. had a bunch of values in rows and
  425. columns, using all 4 CRSR keys to move
  426. through items would be handy!
  427.  
  428.  
  429.     Don't touch that dial! Part 3 is
  430. chock full of good stuff!
  431.  
  432.  
  433.