UI/Memo.py
Main Page
Groups
Classes
Examples
UI/Memo.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 witha Memo and shows how to sets its content
8
# and retrieve its lines.
9
#
10
# Topic: FBStringList, FBMemo
11
#
12
13
from
pyfbsdk
import
*
14
from
pyfbsdk_additions
import
*
15
16
def
OnChange(control,event):
17
print
control.Text
18
19
def
PopulateLayout(mainLyt):
20
#create Spread
21
m =
FBMemo
()
22
23
x =
FBAddRegionParam
(0,FBAttachType.kFBAttachLeft,
""
)
24
y =
FBAddRegionParam
(0,FBAttachType.kFBAttachTop,
""
)
25
w =
FBAddRegionParam
(0,FBAttachType.kFBAttachRight,
""
)
26
h =
FBAddRegionParam
(0,FBAttachType.kFBAttachBottom,
""
)
27
28
mainLyt.AddRegion(
"memo"
,
"memo"
, x, y, w, h)
29
30
mainLyt.SetControl(
"memo"
,m)
31
32
sl =
FBStringList
()
33
sl.Add (
"String 1"
)
34
sl.Add (
"String 2"
)
35
36
m.SetStrings(sl)
37
38
sl2 =
FBStringList
()
39
m.GetStrings(sl2)
40
print
"printing string list"
41
for
s
in
sl2:
42
print
s
43
44
m.OnChange.Add(OnChange)
45
46
def
CreateTool():
47
# Tool creation will serve as the hub for all other controls
48
t =
FBCreateUniqueTool
(
"Memo Example"
)
49
50
t.StartSizeX = 300
51
t.StartSizeY = 300
52
53
PopulateLayout(t)
54
ShowTool
(t)
55
56
57
CreateTool()
58
59