CreateComponent

From OxeyeWiki

Jump to: navigation, search

gui.createComponent(componentType[, parent [, id]])

Creates a new Lunamatic instance of a GUI element. This element will remain in memory even if the Lua variable is lost. To remove the element for real, call the removeComponent to remove the component or the component's parent.

Parameter Expected Type Description
componentType A string Selects what component type that should be created, see below.
parent Optional id name of parent, or the parent element Use this parameter if the component should be placed inside another component, such as a label placed inside a window. You can leave this variable to nil if you don't want a parent.
id Optional string Gives the component an ID name that can be used to identify the component later.
Returns

Returns a Lunamatic reference to a GUI component, or nil if an error occurs.

Daisymoon GUI Lib

Component Types

Type Name Description
label A static text label.
button A button, fetch clicks with the onClick callback.
checkbox An on and off checkbox.
combobox A selection box with a dropdown list.
editbox A single-line edit field.
window A frame with a border, a title bar and hide window buttons. A window can be moved around by the user.
frame A fixed frame with a border. Frames can't be moved, closed or resized by the user.
dframe A "detachable" frame. D-frames can be moved, hidden and resized by the user. They can also be "locked" and made transparent.
layout Layouts are invisible frames that are used for grouping and sorting.
tabrow A single-line group of tabular buttons. Note that tabrows does not have panels (like a tabular pane), so you will need to implement such panels yourself.
listbox A list with a scrollbar that can contain text elements or other GUI components.
vscroll A vertical scrollbar.
hscroll A horizontal scrollbar.

Example

   local frame = gui.createComponent("frame")
   local text = gui.createComponent("label", frame)

   text:setText(WChar("Hello World!"))

   frame:sortVertically(5)
   frame:centerOnParent()
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox