UI/BoxCustomParams.py
 
 
 
UI/BoxCustomParams.py
# Copyright 2009 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement 
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Script description:
# Create a tool that shows all custom params possible with a FBVBoxLayout/FBHBoxLayout.
#
# Topic: FBHBoxLayout, FBVBoxLayout
#

from pyfbsdk import *
from pyfbsdk_additions import *


def PopulateLayout(mainLyt):
    x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
    y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
    w = FBAddRegionParam(5,FBAttachType.kFBAttachRight,"")
    h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
    mainLyt.AddRegion("main","main", x, y, w, h)
    
    lyt = FBHBoxLayout()
    mainLyt.SetControl("main",lyt)
    
    b = FBButton()
    b.Caption = "But0"
    # Custom params: height is fixed in a FBHBoxLayout
    lyt.Add(b,30, height=75)
    
    b = FBButton()
    b.Caption = "But1"
    # Custom params: space between lastly inserted control
    lyt.Add(b,30, space=75,height=50)
    
    b = FBButton()
    b.Caption = "But2"    
    lyt.Add(b,30, height=25)
    
    vlyt = FBVBoxLayout()    
    # Custom params: space between lastly inserted control
    lyt.Add(vlyt,150, space=25)
    
    b = FBButton()
    
    b.Caption = "But3"
    # Custom params: width is fixed in this FBVBoxLayout
    vlyt.Add(b,30, width=75)
    
    b = FBButton()
    b.Caption = "But4"
    vlyt.Add(b,30, space=75,width=50)
    
    b = FBButton()
    b.Caption = "But5"
    vlyt.Add(b,30, width=25)


def CreateTool():
    # Tool creation will serve as the hub for all other controls
    t = FBCreateUniqueTool("Box Custom Params Example")
    t.StartSizeX = 400
    t.StartSizeY = 400

    PopulateLayout(t)
    ShowTool(t)

CreateTool()