from pyfbsdk import *
from pyfbsdk_additions import *
def ShowPopupCallback(control, event):
global t
popup.Show(t)
def ClosePopupCallback(control, event):
popup.Close(True)
def PopulateLayout(mainLyt):
b = FBButton()
b.Caption = "Pop up"
x = FBAddRegionParam(10,FBAttachType.kFBAttachLeft,"")
y = FBAddRegionParam(10,FBAttachType.kFBAttachTop,"")
w = FBAddRegionParam(50,FBAttachType.kFBAttachNone,"")
h = FBAddRegionParam(25,FBAttachType.kFBAttachNone,"")
mainLyt.AddRegion("Btn","Btn", x, y, w, h)
mainLyt.SetControl("Btn",b)
b.OnClick.Add(ShowPopupCallback)
global popup
popup = FBPopup()
popup.Caption = "Popup"
popup.Modal = False
popup.Left = 300
popup.Top = 300
popup.Width = 400
popup.Height = 500
b = FBButton()
b.Caption = "Close"
b.OnClick.Add(ClosePopupCallback)
popup.AddRegion( "Close", "Close", x, y ,w,h )
popup.SetControl("Close", b)
def CreateTool():
global t
t = CreateUniqueTool("Popup Example")
PopulateLayout(t)
ShowTool(t)
CreateTool()