rem 'Set the image for the leaf nodes in a tree control
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(100,100,200,200,"BBjTree",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
tree! = window!.addTree(101,0,0,200,200)
im! = sysgui!.getImageManager()
image$ = "com/basis/bbj/images/red-ball.gif"
image! = im!.loadImageFromServerJar(image$)
tree!.setLeafImage(image!)
rem 'Create root node of tree
PARENT_ID = 0
Tree!.setRoot(PARENT_ID,"Musical Tree")
rem 'Create array to hold ARTIST and songs
DIM MUSIC$[2,4]
MUSIC$[0,0]="The Beatles"
MUSIC$[0,1]="Hey Jude",MUSIC$[0,2]="Let It Be",MUSIC$[0,3]="Twist and Shout",MUSIC$[0,4]="Yesterday"
MUSIC$[1,0]="Paul Simon"
MUSIC$[1,1]="Bridge Over Troubled Waters",MUSIC$[1,2]="Hearts and Bones",MUSIC$[1,3]="Kathy's Song",MUSIC$[1,4]="The Sound of Silence"
MUSIC$[2,0]="Willie Nelson"
MUSIC$[2,1]="Always On My Mind",MUSIC$[2,2]="Getting Over You",MUSIC$[2,3]="Old Fords and Natural Stone",MUSIC$[2,4]="This Morning"
rem 'Add nodes to tree
FOR ARTIST = 0 TO 2
NODE_ID = NODE_ID+1
rem 'Add the artists as expandable nodes on the tree control
Tree!.addExpandableNode(NODE_ID,PARENT_ID,MUSIC$[ARTIST,0])
SONG_PARENT_ID = NODE_ID
FOR SONG = 1 TO 4
NODE_ID = NODE_ID+1
rem 'Add the songs as child nodes of the Artists on the tree control
Tree!.addNode(NODE_ID,SONG_PARENT_ID,MUSIC$[ARTIST,SONG])
NEXT SONG
NEXT ARTIST
process_events
eoj:
release
|