-- card: 3713 from stack: in -- bmap block id: 7051 -- flags: 0000 -- background id: 2685 -- name: Hands-on -- part 1 (field) -- low flags: 00 -- high flags: 0007 -- rect: left=250 top=52 right=294 bottom=510 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: Command ----- HyperTalk script ----- on enterInField set cursor to watch executeField(the target) end enterInField on returnInField if the commandKey is down then send enterInField else pass returnInField end returnInField -- Execute the selected lines in the field on executeField theField put (word 2 of selectedLine())-1 into firstLine put selectedChunk() into saveChunk put selectedText() into commands if (commands = empty) then put value(selectedLine()) into commands repeat with i=1 to the number of lines of commands select line i+firstLine of cd fld "Command" do line i of commands end repeat select saveChunk end executeField -- part 2 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=250 top=22 right=51 bottom=510 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 256 -- line height: 13 -- part name: -- part 3 (field) -- low flags: 00 -- high flags: 0007 -- rect: left=2 top=187 right=314 bottom=247 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: Output ----- HyperTalk script ----- on enterInField put number(chars in the selectedText) end enterInField -- part 5 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=250 top=298 right=314 bottom=301 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 65535 -- font id: 3 -- text size: 10 -- style flags: 256 -- line height: 13 -- part name: -- part 6 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=300 top=298 right=314 bottom=510 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: Error -- part 7 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=2 top=172 right=188 bottom=247 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 10 -- style flags: 256 -- line height: 13 -- part name: ----- HyperTalk script ----- on enterInField set cursor to watch put polish(target) into card field result end enterInField on returnInField if (commandKey() = down) then enterInField else pass returnInField end returnInField -- part contents for background part 13 ----- text ----- Description -- part contents for background part 14 ----- text ----- 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. -- part contents for card part 1 ----- text ----- -- RESEARCH FUNCTIONS -- Get sorted list of handlers in several containers. -- find handlers put empty into cd fld output put research("^(on|function)", "script", "containers number startCard 1 firstCard 1 lastCard 3") into cd fld output put errorstring(research(error)) -- sort output put listSort(cd fld output, ignorecase, return, false, quicksort) into cd fld output set the scroll of cd fld output to 0 put research("!") before cd fld output put research("?") put research(error) put research(matched) put research(pattern, input, options) -- BINARYTREE FUNCTIONS put btree("!") into cd fld output put btree("?") put btree(delete, tree, key) put btree(dispose, tree) put btree(error) put btree(get, tree, "k1,k2", ",") put btree(getattribute, tree, unique) put btree(getattribute, tree, compare) put btree(inorder,tree,false,",", btree(root,tree)) put btree(insert, tree, "k1;k2","d1:d2",";",":") put btree(left, tree, key) put btree(new, tree) into cd fld output put btree(parent, tree, key) put btree(postorder,tree,"",",", btree(root,tree)) put btree(preorder,tree,false,",", btree(root,tree)) put btree(range,tree,k1,k2,false,btree(root,tree)) put btree(right, tree, key) put btree(root, tree) put btree(set,tree,"k1;k2","d1:d2",";",":") put btree(setattribute, tree, unique, true) put btree(setattribute, tree, compare, ignorecase) -- ARRAYLIST FUNCTIONS put alist("!") into cd fld output put alist("?") put alist(add, list, "added item2") put alist(get, "list", ";") put alist(getdimension, list) put alist(size, list) put alist(new, list) put alist(delete, "list[1…3]") put alist(dispose, list) put alist(error) put alist(errorstring) put alist(find, list, "an item") put errorstring(alist(error)) put alist(get, "list") put alist(getattribute, list, sorted) put alist(getattribute, list, compare) put alist(insert, "list[0]", "inserted item2") put alist(new, list) put alist(pop, list) put alist(push, list, "pushed item") put alist(set, list, 1, "set item") put alist(setattribute, list, sorted, true) put alist(setattribute, list, compare, ignorecase) put alist(size, list) put alist(sort, list) put alist(top, list) -- ErrorName put errorname("!") into cd fld output put errorname("?") into cd fld output put errorname(26) put errorname(empty) -- ErrorString put errorstring("!") into cd fld output put errorstring("?") into cd fld output put errorstring(26) put errorstring(errorname(26)) put errorstring(empty) -- part contents for card part 2 ----- text ----- Select lines to execute in field below and press Enter or Command-Return. -- part contents for card part 5 ----- text ----- Error: -- part contents for background part 9 ----- text ----- DemoStack 0.9 -- part contents for background part 1 ----- text ----- Hands-on -- part contents for background part 12 ----- text ----- Card #7 -- part contents for card part 7 ----- text ----- Output -- part contents for card part 3 ----- text ----- script of card 1,1,on openCard script of card 2,1,on openCard