from pyfbsdk import *
from pyfbsdk_additions import *
def ListCallback(control, event):
print control.Items[control.ItemIndex], "has been selected!"
def PopulateLayout(mainLyt):
x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
w = FBAddRegionParam(200,FBAttachType.kFBAttachNone,"")
h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
mainLyt.AddRegion("main","main", x,y,w,h)
lyt = VBoxLayout()
mainLyt.SetControl("main",lyt)
global controls
controls = [FBList(), FBList()]
for l in controls:
l.OnChange.Add(ListCallback)
for i in range(10):
name = "list element %d" % (i + 1)
l.Items.append(name)
controls[0].Style = FBListStyle.kFBDropDownList
lyt.Add(controls[0], 25)
controls[0].Selected(4, True)
controls[1].Style = FBListStyle.kFBVerticalList
lyt.Add(controls[1], 200)
controls[1].Selected(7, True)
controls[1].MultiSelect = True
def CreateTool():
t = CreateUniqueTool("List Example")
PopulateLayout(t)
ShowTool(t)
CreateTool()