home *** CD-ROM | disk | FTP | other *** search
/ Using Asymetrix Multimedi…ool Book Special Edition / SE_UAMT.iso / examples / ch15.tbk (.txt) < prev    next >
Encoding:
Asymetrix ToolBook File  |  1995-09-24  |  37.6 KB  |  514 lines

  1. previous
  2. enterPage
  3. NOTIFYBEFORE 
  4. previous
  5. buttonClick
  6. TO HANDLE buttonClick
  7. Previous
  8. buttonClick
  9. TO HANDLE buttonClick
  10. enterPage
  11. dfield
  12. format.
  13. Your entry is in the correct format.
  14. Your date entry must be in the
  15. keyDown
  16. TO HANDLE 
  17. ZDATE d
  18. ZSTRING s
  19. k <> keyEnter
  20. combobox "dbox" 
  21. sysErrorNumber = 0
  22. "dfield" 
  23. )<> 0
  24. s = "Your 
  25. rentry must be 
  26. the" \
  27. q&& "
  28. s = "
  29. # correct 
  30. mm/dd/yy
  31. mm/dd/yy
  32. mm/dd
  33. seconds
  34. sysDateFormat:
  35. dfield
  36. Enter a date::
  37. TO HANDLE keyDown k
  38. local DATE d
  39. local STRING s
  40. if k <> keyEnter
  41. forward
  42. break
  43. end if
  44. sysDateFormat = text of combobox "dbox" of this page
  45. sysSuspend = false
  46. sysErrorNumber = 0
  47. d = text of field "dfield" of this page
  48. if sysErrorNumber <> 0
  49. s = "Your date entry must be in the" \
  50.     && sysDateFormat && "format."
  51. s = "Your entry is in the correct format."
  52. end if
  53. request s
  54. sysSuspend = true
  55. forward
  56. END keyDown
  57. Script of Enter field:
  58. <BookPath>
  59. :HDMEDIAPATH
  60. System
  61. Arial
  62. Arial
  63. button
  64. oldObject
  65. Script of Button:
  66. NOTIFYBEFORE 
  67. 4STRING oldObject
  68. thisObject
  69.      = objectFromPoint(
  70. $ <> 
  71. "Script 
  72. Button:" & CRLF & 
  73. Script of Button:
  74. TO HANDLE buttonClick
  75.     go to next page
  76. END buttonClicklick
  77. Result:
  78. 65n away for 30 secondst to -3.998562
  79. previous
  80. enterPage
  81. NOTIFYBEFORE 
  82. previous
  83. buttonClick
  84. TO HANDLE buttonClick
  85. Previous
  86. buttonClick
  87. TO HANDLE buttonClick
  88. enterPage
  89. buttonClick
  90. TO HANDLE buttonClick
  91. ZREAL a
  92. a = 4.49
  93. "f" \
  94. local REAL a = 4.49
  95. -",    8
  96. buttonClick
  97. TO HANDLE buttonClick
  98. ZINT a
  99. a = 4.49
  100. "f" \
  101. local INT a = 4.49
  102. -#,    8
  103. buttonClick
  104. TO HANDLE buttonClick
  105. ZWORD a
  106. a = 4.49
  107. "f" \
  108. local WORD a = 4.49
  109. -",    8
  110. buttonClick
  111. TO HANDLE buttonClick
  112. ZINT a
  113. a = -4.49
  114. "f" \
  115. local INT a = -4.49
  116. -#,    8
  117. buttonClick
  118. TO HANDLE buttonClick
  119. ZWORD a
  120. a = -4.49
  121. "f" \
  122. local WORD a = -4.49
  123. TO HANDLE buttonClick
  124. ZINT a
  125. a = 6
  126. "f" \
  127. local INT a = 60000 (Won't Compile)
  128. CDBSE&File
  129. &Open...    Ctrl+O
  130. &Save    Ctrl+S
  131. Save &As...
  132. saveas
  133. &Import...
  134. import
  135. &Export...
  136. export
  137. Print Set&up...
  138. printsetup
  139. &Print Pages...    Ctrl+P
  140. printpages
  141. Prin&t Report...
  142. printreport
  143. Send &Mail...
  144. sendmail
  145. &Run...
  146. E&xit    Alt+F4
  147. &Edit
  148. &Undo    Ctrl+Z
  149. Cu&t    Ctrl+X
  150. &Copy    Ctrl+C
  151. &Paste    Ctrl+V
  152. paste
  153. C&lear    Del
  154. clear
  155. Select &All    Shift+F9
  156. selectall
  157. Select Pa&ge    Shift+F12
  158. selectpage
  159. &Size to Page    F11
  160. sizetopage
  161. F&ind...    F5
  162. Re&place...
  163. replace
  164. Aut&hor    F3
  165. author
  166. &Text
  167. &Character...    F6
  168. character
  169. &Paragraph...    F7
  170. paragraph
  171. &Regular    Ctrl+Space
  172. regular
  173. &Bold    Ctrl+B
  174. &Italic    Ctrl+I
  175. italic
  176. &Underline    Ctrl+U
  177. underline
  178. Stri&keout    Ctrl+K
  179. strikeout
  180. Superscrip&t/Subscript
  181. superscriptSubscript
  182. &Normal Script
  183. normalscript
  184. Su&bscript    Ctrl+L
  185. subscript
  186. Su&perscript    Ctrl+Shift+L
  187. superscript
  188. &Show Hotwords    F9
  189. showhotwords
  190. &Page
  191. &Next    Alt+Right
  192. &Previous    Alt+Left
  193. previous
  194. &First    Alt+Up
  195. first
  196. &Last    Alt+Down
  197. &Back    Shift+F2
  198. &History...    Ctrl+F2
  199. history
  200. N&ew Page    Ctrl+N
  201. newpage
  202. &Help
  203. &Contents    F1
  204. contents
  205. Status &Bar    F12
  206. statusbar
  207. splunge
  208. buttonClick
  209. TO HANDLE buttonClick
  210. "splunge" 
  211. character 2 of "splunge"
  212. splunge
  213. buttonClick
  214. TO HANDLE buttonClick
  215. "splunge" \
  216. characters 3 to 6 of "splunge"
  217. splunge
  218. buttonClick
  219. TO HANDLE buttonClick
  220. "splunge" \
  221. chars 3 to 6 of "splunge"
  222. splunge
  223. buttonClick
  224. TO HANDLE buttonClick
  225. ZSTRING theString
  226.  = "splunge"
  227. chars 2 to 4 of theString
  228. splunge
  229. buttonClick
  230. TO HANDLE buttonClick
  231. "splunge" \
  232. sixth char of "splunge"
  233. Paris in the splunge
  234. spring
  235. buttonClick
  236. TO HANDLE buttonClick
  237. ZSTRING x
  238. x = "Paris 
  239. the splunge"
  240. x = "spring"
  241. "Paris in the splunge"
  242. previous
  243. enterPage
  244. NOTIFYBEFORE 
  245. previous
  246. buttonClick
  247. TO HANDLE buttonClick
  248. Previous
  249. buttonClick
  250. TO HANDLE buttonClick
  251. enterPage
  252. cabbage,squid,tuna,snowflake
  253. Which of these has a backbone?
  254. Select From List
  255. enterPage
  256. Correct!
  257. Try Again
  258. buttonClick
  259. TO HANDLE 
  260. ZSTACK vs
  261. ZSTRING vt
  262. ZLONG i
  263. "f" = NULL
  264. "f2" = "Select From List"
  265.     --This list would typically originate somewhere 
  266. %the result 
  267. user input 
  268. a calculation
  269.     vs = "cabbage,squid,tuna,snowflake"
  270. "f" = \
  271.     "Which 
  272. these has a backbone?" & CRLF & 
  273. B(I + 2) 
  274. "f" = 
  275. B(i + 2) 
  276. "f" = 
  277. buttonClick
  278. "f2" = "Correct!"
  279. "f2" = "Try Again"
  280. Which of these has a backbone?
  281. cabbage
  282. squid
  283. snowflake
  284. Select From List
  285. buttonClick
  286. TO HANDLE buttonClick
  287. Start Over
  288. -",    7
  289. Thou shalt not count to 
  290. Result:
  291. buttonClick
  292. TO HANDLE buttonClick
  293. ZSTRING t
  294. "f" \
  295. /= "Result:"
  296. --Space 
  297. 4the closing 
  298. t = "Thou shalt 
  299. xcount 
  300. x = 4
  301. Hand Grenade Instruction
  302. Result:
  303. Neither shall thou count to 
  304. buttonClick
  305. TO HANDLE buttonClick
  306. ZREAL
  307. ZSTRING t
  308. "f" \
  309. /= "Result:"
  310. --Space 
  311. 4the closing 
  312. t = "Neither shall thou count 
  313. x = -3.998562
  314. An Even Better Instruction
  315. .&,    7
  316. Run away for xxxx seconds
  317. buttonClick
  318. TO HANDLE buttonClick
  319. ZSTRING t
  320. t = "Run away 
  321. xxxx 
  322. t = 30
  323. en To Run Away
  324. The Great Event In A Word
  325. The Great Event In Two Characters
  326. When To Run Away
  327. The event happened 35 years ago
  328. buttonClick
  329. TO HANDLE buttonClick
  330. "The event happened 35 years ago" \
  331. + 30 \
  332. The event happened 35 years ago
  333. buttonClick
  334. TO HANDLE buttonClick
  335. "The event happened 35 years ago" \
  336. + 30 \
  337. previous
  338. enterPage
  339. NOTIFYBEFORE 
  340. previous
  341. buttonClick
  342. TO HANDLE buttonClick
  343. Previous
  344. buttonClick
  345. TO HANDLE buttonClick
  346. enterPage
  347. theText
  348. buttonClick
  349. TO HANDLE buttonClick
  350. Zx[ ][ ]
  351. ZLONG a,i,j,y,z
  352.     a = 1
  353. f1 = NULL
  354.     theText = 
  355.     fill x 
  356. g] order
  357. dimensions(x)
  358. "f1" = x[i][j]
  359. field(f1)
  360. field(f2)
  361. field(f3)
  362. test.
  363. field(f4)
  364. [textline][word]
  365. This is a test
  366. of the
  367. text parser. Each
  368. word is parsed.
  369. parser.
  370. parsed.
  371. theText
  372. buttonClick
  373. TO HANDLE buttonClick
  374. Zx[ ][ ]
  375. ZLONG a,i,j,y,z
  376.     a = 1
  377. "f1" = NULL
  378.     theText = 
  379.     fill x 
  380. R] order
  381. dimensions(x)
  382. "f1" = x[i][j]
  383. field(f1)
  384. field(f2)
  385. field(f3)
  386. test.
  387. field(f4)
  388. [word][char]
  389. button
  390. previous
  391. buttonUp
  392. NOTIFYBEFORE 
  393. TO HANDLE buttonClick
  394.     local x[ ][ ]
  395.     local LONG a,i,j,y,z
  396.     a = 1
  397.     text of field f1 = NULL
  398.     theText = text of field "f2"
  399.     fill x with theText in [textline][word] order
  400.     y =  item 1 of dimensions(x)
  401.     z =  item 2 of dimensions(x)
  402.     step i from 1 to y
  403.         step j from 1 to z
  404.             textline a of text of \
  405.             field "f1" = x[i][j]
  406.             increment a
  407.         end step
  408.     end step
  409. END buttonClick
  410. buttonUp
  411. Enter Textlines Here:
  412. previous
  413. enterPage
  414. NOTIFYAFTER 
  415. previous
  416. buttonClick
  417. TO HANDLE buttonClick
  418. Previous
  419. buttonClick
  420. TO HANDLE buttonClick
  421. enterPage
  422. This is text in a field. As long as wordwrap is used, these are not textlines, since there is no CRLF at the end of each line. The whole paragraph is a textline.
  423. These are textlines.
  424. The return key was pressed.
  425. Use the textline operator to get these.
  426. This,is,a,list,in,a,field.eld is containe
  427. A single-select list goes here..
  428. A single-select list goes here.
  429. These are the drop-down items.
  430. They are textlines.
  431. word 2 of text of field "f" = "is"
  432. char 2 of word 3 of text of field "f = "e"
  433. --The paragraph breaks increment the
  434. --textline count.
  435. textline 3 of text of field "f" = "These are textlines."
  436. word 1 of textline 3 of text of field "f" = "These"
  437. --lists are more efficient when in variables,
  438. --but can be used from fields:
  439. item 7 of textline 7 of text of field "f" = "field"
  440. text of combobox "c" = \
  441. "A single-select list goes here."
  442. --dropDownItems is a property of combo boxes.
  443. textline 2 of dropDownItems of combobox "c" = \
  444. "These are the drop-down items."
  445. cabbage,squid,tuna,snowflake
  446. Which of these has a backbone?
  447. Select From List
  448. enterPage
  449. Correct!
  450. Try Again
  451. buttonClick
  452. TO HANDLE 
  453. ZSTACK vs
  454. ZSTRING vt
  455. ZLONG i
  456. "f" = NULL
  457. "f2" = "Select From List"
  458.     --This list would typically originate somewhere 
  459. %the result 
  460. user input 
  461. a calculation
  462.     vs = "cabbage,squid,tuna,snowflake"
  463. "f" = \
  464.     "Which 
  465. these has a backbone?" & CRLF & 
  466. B(I + 2) 
  467. "f" = 
  468. B(i + 2) 
  469. "f" = 
  470. buttonClick
  471. "f2" = "Correct!"
  472. "f2" = "Try Again"
  473. Which of these has a backbone?
  474. cabbage
  475. squid
  476. snowflake
  477. Select From List
  478. buttonClick
  479. TO HANDLE buttonClick
  480. Start Over
  481. button
  482. oldObject
  483. Script of Button:
  484. NOTIFYBEFORE 
  485. 4STRING oldObject
  486. thisObject
  487.      = objectFromPoint(
  488. $ <> 
  489. "Script 
  490. Button:" & CRLF & 
  491. Script of Button:
  492. TO HANDLE buttonClick
  493.     go to next page
  494. END buttonClicklick
  495. Result:
  496. 65n away for 30 secondst to -3.998562
  497. previous
  498. enterPage
  499. NOTIFYBEFORE 
  500. previous
  501. buttonClick
  502. TO HANDLE buttonClick
  503. Previous
  504. buttonClick
  505. TO HANDLE buttonClick
  506. enterPage
  507. Script of Button:
  508. TO HANDLE buttonClick
  509. put character 2 of "splunge" into textline 2 \
  510. of text of field "f" of this background
  511. END buttonClick
  512. k of field "f" of this background
  513. END buttonClick
  514.