from pyfbsdk import *
from pyfbsdk_additions import *
def TreeSelectCallback(control, event):
print "Node : ",event.TreeNode.Name, " selected."
def PopulateLayout(mainLyt):
x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
w = FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")
h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
mainLyt.AddRegion("main","main", x, y, w, h)
t = FBTree()
t.CheckBoxes = True
t.AutoExpandOnDblClick = True
t.AutoExpandOnDragOver = True
t.AutoScroll = True
t.AutoScrollOnExpand = True
t.ItemHeight = 40
t.DeselectOnCollapse = True
t.EditNodeOn2Select = True
t.HighlightOnRightClick = True
t.MultiDrag = True
t.MultiSelect = True
t.NoSelectOnDrag = True
t.NoSelectOnRightClick = False
t.ShowLines = True
mainLyt.SetControl("main",t)
r = t.GetRoot()
n = t.InsertLast(r, "1")
n = t.InsertLast(n, "2")
n = t.InsertLast(n, "3")
n = t.InsertLast(n, "4")
n = t.InsertLast(r, "5")
n = t.InsertLast(n, "6")
t.InsertLast(n, "7")
t.OnSelect.Add(TreeSelectCallback)
def CreateTool():
t = CreateUniqueTool("Tree Tool Example")
t.StartSizeX = 400
t.StartSizeY = 400
PopulateLayout(t)
ShowTool(t)
CreateTool()