home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / xcmd / prctclxf.sit / DemoStack / card_3713.txt < prev    next >
Text File  |  1990-08-28  |  6KB  |  259 lines

  1. -- card: 3713 from stack: in
  2. -- bmap block id: 7051
  3. -- flags: 0000
  4. -- background id: 2685
  5. -- name: Hands-on
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 00
  10. -- high flags: 0007
  11. -- rect: left=250 top=52 right=294 bottom=510
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 3
  16. -- text size: 9
  17. -- style flags: 0
  18. -- line height: 12
  19. -- part name: Command
  20. ----- HyperTalk script -----
  21. on enterInField
  22.   set cursor to watch
  23.   executeField(the target)
  24. end enterInField
  25.  
  26. on returnInField
  27.   if the commandKey is down then send enterInField
  28.   else pass returnInField
  29. end returnInField
  30.  
  31. -- Execute the selected lines in the field
  32. on executeField theField
  33.   put (word 2 of selectedLine())-1 into firstLine
  34.   put selectedChunk() into saveChunk
  35.   put selectedText() into commands
  36.   if (commands = empty) then put value(selectedLine()) into commands
  37.   repeat with i=1 to the number of lines of commands
  38.     select line i+firstLine of cd fld "Command"
  39.     do line i of commands
  40.   end repeat
  41.   select saveChunk
  42. end executeField
  43.  
  44.  
  45.  
  46.  
  47. -- part 2 (field)
  48. -- low flags: 01
  49. -- high flags: 0002
  50. -- rect: left=250 top=22 right=51 bottom=510
  51. -- title width / last selected line: 0
  52. -- icon id / first selected line: 0 / 0
  53. -- text alignment: 0
  54. -- font id: 3
  55. -- text size: 10
  56. -- style flags: 256
  57. -- line height: 13
  58. -- part name: 
  59.  
  60.  
  61. -- part 3 (field)
  62. -- low flags: 00
  63. -- high flags: 0007
  64. -- rect: left=2 top=187 right=314 bottom=247
  65. -- title width / last selected line: 0
  66. -- icon id / first selected line: 0 / 0
  67. -- text alignment: 0
  68. -- font id: 3
  69. -- text size: 9
  70. -- style flags: 0
  71. -- line height: 12
  72. -- part name: Output
  73. ----- HyperTalk script -----
  74. on enterInField
  75.   put number(chars in the selectedText)
  76. end enterInField
  77.  
  78.  
  79.  
  80. -- part 5 (field)
  81. -- low flags: 01
  82. -- high flags: 0002
  83. -- rect: left=250 top=298 right=314 bottom=301
  84. -- title width / last selected line: 0
  85. -- icon id / first selected line: 0 / 0
  86. -- text alignment: 65535
  87. -- font id: 3
  88. -- text size: 10
  89. -- style flags: 256
  90. -- line height: 13
  91. -- part name: 
  92.  
  93.  
  94. -- part 6 (field)
  95. -- low flags: 01
  96. -- high flags: 0002
  97. -- rect: left=300 top=298 right=314 bottom=510
  98. -- title width / last selected line: 0
  99. -- icon id / first selected line: 0 / 0
  100. -- text alignment: 0
  101. -- font id: 4
  102. -- text size: 9
  103. -- style flags: 0
  104. -- line height: 12
  105. -- part name: Error
  106.  
  107.  
  108. -- part 7 (field)
  109. -- low flags: 01
  110. -- high flags: 0002
  111. -- rect: left=2 top=172 right=188 bottom=247
  112. -- title width / last selected line: 0
  113. -- icon id / first selected line: 0 / 0
  114. -- text alignment: 1
  115. -- font id: 3
  116. -- text size: 10
  117. -- style flags: 256
  118. -- line height: 13
  119. -- part name: 
  120. ----- HyperTalk script -----
  121. on enterInField
  122.   set cursor to watch
  123.   put polish(target) into card field result
  124. end enterInField
  125.  
  126. on returnInField
  127.   if (commandKey() = down) then enterInField
  128.   else pass returnInField
  129. end returnInField
  130.  
  131.  
  132.  
  133.  
  134. -- part contents for background part 13
  135. ----- text -----
  136. Description
  137.  
  138. -- part contents for background part 14
  139. ----- text -----
  140.  
  141. The field to the right can be used to enter commands directly to one of the XFCNs. Simply type a command or commands, select the desired lines, and press Enter or Command-Return to execute those lines. The field labeled "Output" may be used to dump output.
  142.  
  143.  
  144. -- part contents for card part 1
  145. ----- text -----
  146.  
  147. -- RESEARCH FUNCTIONS
  148.  
  149. -- Get sorted list of handlers in several containers.
  150.  
  151. -- find handlers
  152. put empty into cd fld output
  153. put research("^(on|function)", "script", "containers  number startCard 1 firstCard 1 lastCard 3") into cd fld output
  154. put errorstring(research(error))
  155. -- sort output
  156. put listSort(cd fld output, ignorecase, return, false, quicksort) into cd fld output
  157. set the scroll of cd fld output to 0
  158.  
  159. put research("!") before cd fld output
  160. put research("?")
  161. put research(error)
  162. put research(matched)
  163. put research(pattern, input, options)
  164.  
  165. -- BINARYTREE FUNCTIONS
  166. put btree("!") into cd fld output
  167. put btree("?")
  168. put btree(delete, tree, key)
  169. put btree(dispose, tree)
  170. put btree(error)
  171. put btree(get, tree, "k1,k2", ",")
  172. put btree(getattribute, tree, unique)
  173. put btree(getattribute, tree, compare)
  174. put btree(inorder,tree,false,",", btree(root,tree))
  175. put btree(insert, tree, "k1;k2","d1:d2",";",":")
  176. put btree(left, tree, key)
  177. put btree(new, tree) into cd fld output
  178. put btree(parent, tree, key)
  179. put btree(postorder,tree,"",",", btree(root,tree))
  180. put btree(preorder,tree,false,",", btree(root,tree))
  181. put btree(range,tree,k1,k2,false,btree(root,tree))
  182. put btree(right, tree, key)
  183. put btree(root, tree)
  184. put btree(set,tree,"k1;k2","d1:d2",";",":")
  185. put btree(setattribute, tree, unique, true)
  186. put btree(setattribute, tree, compare, ignorecase)
  187.  
  188. -- ARRAYLIST FUNCTIONS
  189. put alist("!") into cd fld output
  190. put alist("?")
  191. put alist(add, list, "added item2")
  192. put alist(get, "list", ";")
  193. put alist(getdimension, list)
  194. put alist(size, list)
  195. put alist(new, list)
  196. put alist(delete, "list[1ΓǪ3]")
  197. put alist(dispose, list)
  198. put alist(error)
  199. put alist(errorstring)
  200. put alist(find, list, "an item")
  201. put errorstring(alist(error))
  202. put alist(get, "list")
  203. put alist(getattribute, list, sorted)
  204. put alist(getattribute, list, compare)
  205. put alist(insert, "list[0]", "inserted item2")
  206. put alist(new, list)
  207. put alist(pop, list)
  208. put alist(push, list, "pushed item")
  209. put alist(set, list, 1, "set item")
  210. put alist(setattribute, list, sorted, true)
  211. put alist(setattribute, list, compare, ignorecase)
  212. put alist(size, list)
  213. put alist(sort, list)
  214. put alist(top, list)
  215.  
  216. -- ErrorName
  217. put errorname("!") into cd fld output
  218. put errorname("?") into cd fld output 
  219. put errorname(26)
  220. put errorname(empty)
  221.  
  222. -- ErrorString
  223. put errorstring("!") into cd fld output
  224. put errorstring("?") into cd fld output
  225. put errorstring(26)
  226. put errorstring(errorname(26))
  227. put errorstring(empty)
  228.  
  229.  
  230.  
  231. -- part contents for card part 2
  232. ----- text -----
  233. Select lines to execute in field below and press Enter or Command-Return.
  234.  
  235. -- part contents for card part 5
  236. ----- text -----
  237. Error:
  238.  
  239. -- part contents for background part 9
  240. ----- text -----
  241. DemoStack 0.9
  242.  
  243. -- part contents for background part 1
  244. ----- text -----
  245. Hands-on
  246.  
  247. -- part contents for background part 12
  248. ----- text -----
  249. Card #7
  250.  
  251. -- part contents for card part 7
  252. ----- text -----
  253. Output
  254.  
  255. -- part contents for card part 3
  256. ----- text -----
  257. script of card 1,1,on openCard
  258. script of card 2,1,on openCard
  259.