Python Reference Guide
 
Loading...
Searching...
No Matches
UI\Scrollbox.py
1# Copyright 2009 Autodesk, Inc. All rights reserved.
2# Use of this software is subject to the terms of the Autodesk license agreement
3# provided at the time of installation or download, or which otherwise accompanies
4# this software in either electronic or hard copy form.
5#
6# Script description:
7# Create a tool with a scrollbox that helps managing large content area.
8#
9# Topic: FBGridLayout,FBScrollBox
10#
11
12from pyfbsdk import *
13from pyfbsdk_additions import *
14
15
16def PopulateLayout(mainLyt):
17 x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
18 y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
19 w = FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")
20 h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
21 mainLyt.AddRegion("main","main", x, y, w, h)
22
23 # create a scrollbox and set it as the main control in our tool
24 scroll = FBScrollBox()
25 mainLyt.SetControl("main",scroll)
26 # Content property is the scrollbox's layout: create a region in it
27 scroll.Content.AddRegion( "content", "content", x, y, w, h )
28
29 lyt = FBGridLayout()
30 # set our layout as the content of the scrollbox
31 scroll.Content.SetControl("content", lyt)
32
33 # init the scrollbox content size. We will be able to scroll on this size.
34 scroll.SetContentSize(800, 800)
35
36 # populate our grid with dummy buttons
37 for i in range(7):
38 for j in range(7):
39 b = FBButton()
40 b.Caption = "%d, %d" % (i, j)
41 lyt.Add(b, i, j)
42
43
44def CreateTool():
45 # Tool creation will serve as the hub for all other controls
46 t = FBCreateUniqueTool("Scrollbox Tool Example")
47 t.StartSizeX = 400
48 t.StartSizeY = 400
49 PopulateLayout(t)
50 ShowTool(t)
51
52CreateTool()
Used to create and manage buttons in a user interface.
Definition: pyfbsdk_generated.h:2442
Scroll Box.
Definition: pyfbsdk_generated.h:16979