from pyfbsdk import *
from pyfbsdk_additions import *
def OnChangeCallback(control, event):
print control.GetSelection()
def OnDoubleClickCallback(control, event):
print control.GetSelection()
def OnDragAndDropCallback(control, event):
print event.State, event.PosX, event.PosY, event.Data0, event.Data1, event.Components
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)
lyt = HBoxLayout()
mainLyt.SetControl("main",lyt)
icons = ["devices_body.tif", "devices_generalpurp.tif", "devices_gloves.tif", "devices_joystick.tif", "devices_keyboard.tif", "devices_mouse.tif"]
containers = [FBContainer(), FBContainer()]
for containerIndex, c in enumerate(containers):
for i, icon in enumerate(icons):
itemIndex = ((containerIndex * 7) + i);
c.Items.append(("Item %d" % itemIndex, itemIndex ) )
c.ItemIconSet(itemIndex, icon)
c.ItemHeight = 70
c.ItemWidth = 70
c.OnDblClick.Add(OnDoubleClickCallback)
c.OnChange.Add(OnChangeCallback)
c.OnDragAndDrop.Add(OnDragAndDropCallback)
lyt.AddRelative(c)
containers[0].Orientation = FBOrientation.kFBHorizontal
containers[1].Orientation = FBOrientation.kFBVertical
def CreateTool():
t = CreateUniqueTool("Container Tool Example")
t.StartSizeX = 400
t.StartSizeY = 400
PopulateLayout(t)
ShowTool(t)
CreateTool()