rem ' getDragEnabled
sysgui=unt open (sysgui)"X0" sysgui!=BBjAPI().getSysGui() parent_id=0 node_id=100 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" window!=sysgui!.addWindow(200,200,300,250,"Musical Tree",$0093$,$$) tree!=window!.addTree(101,0,0,300,250) tree!.setDragEnabled(0) dragEnabled = tree!.getDragEnabled() tree!.setRoot(parent_id,"Musical Tree") FOR ARTIST=0 TO 2 node_id=node_id+1 tree!.addExpandableNode(node_id,parent_id,MUSIC$[ARTIST,0]) song_parent_id=node_id FOR SONG=1 TO 4 node_id=node_id+1 tree!.addNode(node_id,song_parent_id,MUSIC$[ARTIST,SONG]) NEXT SONG NEXT ARTIST window!.setVisible(1) CALLBACK(ON_TREE_SELECT,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_TREE_DESELECT,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_TREE_EXPAND,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_TREE_COLLAPSE,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_TREE_EDIT_STOP,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_TREE_MOUSE_UP,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_TREE_MOUSE_DOWN,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_TREE_DOUBLE_CLICK,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_TREE_RIGHT_MOUSE_UP,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_TREE_RIGHT_MOUSE_DOWN,TREE_MOUSE,sysgui!.getContext(),tree!.getID()) CALLBACK(ON_CLOSE,APP_CLOSE,sysgui!.getContext()) PROCESS_EVENTS tree_mouse: dim event$:tmpl(sysgui),generic$:noticetpl(0,0) event$=sysgui!.getLastEventString() generic$=notice(sysgui,event.x) dim notice$:noticetpl(generic.objtype,event.flags) notice$=generic$ switch notice.code case 1; print "Node",notice.node," selected"; break case 2; print "Node",notice.node," deselected"; break case 3; print "Node",notice.node," expanded"; break case 4; print "Node",notice.node," collapsed"; break case 5; print "Node",notice.node," editing stopped"; break case 6; if notice.lparam then print "Mouse down" else print "Mouse up" fi; break case 7; print "Mouse double click"; break case 8; if notice.lparam then print "Right mouse down" else print "Right mouse up" fi; break print "Unknown event",notice.code swend return APP_CLOSE: RELEASE
|