Guest User

Untitled

a guest
Oct 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #MB2011
  2. #なんの変哲もないVerticalListなんだけど、リストの値を上からlist mohi1,list mohi2,list mohi3...と複数選択していくと値が取得できず、
  3. #下からlist mohi10,list mohi9,list mohi8って選択していくとその時選択した値が得られる・・・。
  4.  
  5. from pyfbsdk import *
  6. from pyfbsdk_additions import *
  7.  
  8. def ListCallback(control, event):
  9. for idx,item in enumerate(control.Items):
  10.    if control.IsSelected(idx):
  11.     print item, "has been selected!"
  12.  
  13. def PopulateLayout(mainLyt):
  14. x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
  15. y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
  16. w = FBAddRegionParam(200,FBAttachType.kFBAttachNone,"")
  17. h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
  18. mainLyt.AddRegion("main","main", x,y,w,h)
  19. lyt = VBoxLayout()
  20. mainLyt.SetControl("main",lyt)
  21.  
  22. # List creation
  23. global controls
  24. controls = FBList()
  25. controls.OnChange.Add(ListCallback)
  26. # fill the list with dummy data
  27. for i in range(10):
  28. name = "list mohi %d" % (i + 1)
  29. controls.Items.append(name)
  30. controls.Style = FBListStyle.kFBVerticalList
  31. lyt.Add(controls, 200)
  32. controls.Selected(0,False)
  33. controls.MultiSelect =True
  34.  
  35.  
  36. def CreateTool():
  37. t = CreateUniqueTool("List Example")
  38. PopulateLayout(t)
  39. ShowTool(t)
  40.  
  41.  
  42. CreateTool()
Add Comment
Please, Sign In to add comment