|
| 1 | +Name: create widget |
| 2 | + |
| 3 | +Type: command |
| 4 | + |
| 5 | +Associations: widget |
| 6 | + |
| 7 | +Syntax: create [invisible] widget [<controlName>] as <widgetKind> [in <group>] |
| 8 | + |
| 9 | +Summary: Create a <widget> control of the specified <kind>. |
| 10 | + |
| 11 | +Introduced: 8.0 |
| 12 | + |
| 13 | +OS: mac,windows,linux,ios,android |
| 14 | + |
| 15 | +Platforms: desktop,server,web,mobile |
| 16 | + |
| 17 | +Example: |
| 18 | +create widget "My Navbar" as "com.livecode.widget.navbar" |
| 19 | + |
| 20 | +Example: |
| 21 | +create group "Swatches" |
| 22 | +repeat with x = 1 to 20 |
| 23 | + create invisible widget ("Color Swatch" && x) as "com.livecode.widget.colorswatch" in group "Swatches" |
| 24 | +end repeat |
| 25 | + |
| 26 | +Parameters: |
| 27 | +controlName: The name to call the newly created <widget>. If you don't specify a name, the <widget> is created with a default name. |
| 28 | +widgetKind: The name of the module that defines the widget to be created. |
| 29 | +group: A reference or an expression that evaluates to a reference to a group on the current card. If you specify a group, the new <widget> is a member of the <group>, and exists on each <card> that has the <group>. If you don't specify a <group>, the <widget> is created on the current <card> and appears only on that <card>. |
| 30 | + |
| 31 | +It: The <create widget> command places the ID property of the newly created <widget> in the <it> variable. |
| 32 | + |
| 33 | +Description: |
| 34 | +Use the <create widget> command to make a new <widget> control or grouped <widget> control of <kind> <widgetKind>. |
| 35 | + |
| 36 | +If you use the invisible form, the <widget> is created with its <visible> property set to false, so it cannot be seen. Use this form to create a hidden <widget>, change its appearance or position, then make it visible. |
| 37 | + |
| 38 | +When the new <widget> is created, the pointer tool is automatically chosen. |
| 39 | + |
| 40 | +>*Note:* The <LCB extension|extension> of the specified <kind> must have been loaded using the <load extension> command. To see a list of the currently loaded <LiveCode Builder extension|extensions>, use the <loadedExtensions> <function>. |
| 41 | + |
| 42 | +References: kind (property), load extension (command), loadedExtensions (function), widget (object), card (object), group (object), visible (property), LiveCode Builder extension (glossary), it (keyword) |
| 43 | + |
| 44 | +Tags: objects, extensions |
0 commit comments