This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathcreate.lcdoc
More file actions
110 lines (78 loc) · 3.14 KB
/
create.lcdoc
File metadata and controls
110 lines (78 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Name: create
Synonyms: new
Type: command
Syntax: create [invisible] <objectType> [<objectName>] [in {<group>|<card>}]
Summary:
Creates a new object on the current card.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
create button "Click Me"
Example:
create invisible field in group 1
Example:
create button "Click me" in card "Card1"
Parameters:
objectType (enum):
- "field"
- "button"
- "image"
- "scrollbar"
- "graphic"
- "player"
objectName:
The name to call the newly created object. If you don't
specify a name, the object is created with a default name.
group:
A reference or and expression that evaluates to a reference to a
group on the current card. If you specify a group, the new object is a
member of the group, and exists on each card that has the group. If you
specify neither a group nor a card, the object is created on the
current card and appears only on that card.
card:
A reference or and expression that evaluates to a reference to a
card. If you specify a card, the control will be a member of that
card, otherwise it will be a member of the current card.
It:
The <create> command places the ID property of the newly created
object in the it variable.
Description:
Use the create command to make a new control or grouped control.
The new object takes its properties from the corresponding template;
for example, newly created buttons match the properties of the
<templateButton>.
If you use the invisible form, the object is created with its visible
property set to false, so it cannot be seen. Use this form to create a
hidden object, change its appearance or position, then make it visible.
When the new control is created, the Pointer tool is automatically
chosen. If you use the create command in a handler, you can use the
following statement after the create command to resume using the Browse
tool: send "choose browse tool" to me in 1 tick
>*Note:* In the development environment, after an object is created,
LiveCode automatically resets the corresponding template to its default
values. This means that if you change an object template and then
create several objects of that type, only the first object will reflect
your settings. To prevent LiveCode from automatically setting the
template back to its defaults, set the <lockMessages> property to true
before creating the objects:
set the borderWidth of the templateButton to 8
lock messages
repeat for 5 times
create button
end repeat
unlock messages
LiveCode resets the template only when in the development environment,
not in standalone applications.
>*Tip:* To create a control in a specific stack, first set the
<defaultStack> to the stack where you want to create the new control:
set the defaultStack to "My Stack"
create button "My Button"
or create the control in a card attached to the specific stack:
create stack "Specific stack"
create card "Example Card" in stack "Specific stack"
create button "My Button" in card "Example Card"
References: create stack (command), create card (command),
templateButton (keyword), lockMessages (property),
defaultStack (property)
Tags: objects