1
2
3
4
5
6
7
8
9
10
11
12from pyfbsdk import *
13from pyfbsdk_additions import *
14
15def ListCallback(control, event):
16 print(control.Items[control.ItemIndex], "has been selected!")
17
18
19def PopulateLayout(mainLyt):
20 x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
21 y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
22 w = FBAddRegionParam(200,FBAttachType.kFBAttachNone,"")
23 h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
24 mainLyt.AddRegion("main","main", x,y,w,h)
25
26 lyt = FBVBoxLayout()
27 mainLyt.SetControl("main",lyt)
28
29
30
31 global controls
33 for l in controls:
34 l.OnChange.Add(ListCallback)
35
36 for i in range(10):
37 name = "list element %d" % (i + 1)
38 l.Items.append(name)
39
40
41
42
43 controls[0].Style = FBListStyle.kFBDropDownList
44 lyt.Add(controls[0], 25)
45 controls[0].Selected(4, True)
46
47 controls[1].Style = FBListStyle.kFBVerticalList
48 lyt.Add(controls[1], 200)
49 controls[1].Selected(7, True)
50 controls[1].MultiSelect = True
51
52
53def CreateTool():
54
55 t = FBCreateUniqueTool("List Example")
56 PopulateLayout(t)
57 ShowTool(t)
58
59
60CreateTool()
List of items.
Definition: pyfbsdk_generated.h:10213