-- build a tree containing text from the poem "Father William"
-- by Lewis Carroll
set cursor to watch
setTreeDirty
get btree(dispose, treeName())
get btree(new, treeName())
put "You are old Father William the young man said And your hair has become very white And yet you incessantly stand on your head Do you think at your age it is right" into keys
put "In my youth Father William replied to his son I feared it might injure the brain But now that I'm perfectly sure I have none Why I do it again and again" into data
if (commands = empty) then put value(selectedLine()) into commands
repeat with i=1 to number(lines of commands)
select line i+firstLine of cd fld "Commands"
do line i of commands
end repeat
select saveChunk
end executeField
-- part 19 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=36 top=294 right=312 bottom=135
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part contents for background part 9
----- text -----
DemoStack 0.9
-- part contents for background part 1
----- text -----
Draw Tree
-- part contents for background part 12
----- text -----
Card #10
-- part contents for background part 14
----- text -----
-- part contents for card part 14
----- text -----
Finished Drawing Keys.
-- part contents for card part 18
----- text -----
Instructions:
"Draw Tree" draws the demo tree, which should first be configured using one of the other buttons. A dialog box asks what type of data to draw: the keys of the nodes, the data fields of the nodes, or the indexes of the nodes.
"Random Tree" builds and draws a tree containing random integers.
"Complete Tree" builds and draws a tree containing all of its nodes.
"Father William" builds and draws a tree containing part of the poem "Father William" by Lewis Carroll.