Difference between revisions of "Lua:Class:Control"
Jump to navigation
Jump to search
Line 77: | Line 77: | ||
<pre> | <pre> | ||
− | Example: | + | --Example: |
local forms = createForm() | local forms = createForm() | ||
local labels = createLabel(forms) | local labels = createLabel(forms) |
Revision as of 07:22, 14 April 2012
Control Class (Inheritance Component->Object) control_setCaption(control, caption)
Sets the text on a control. All the gui objects fall in this category
control_getCaption(control)
Returns the text of the control
control_setPosition(control, x,y)
Sets the x and y position of the object base don the top left position (relative to the client array of the owner object)
control_getPosition(contron)
Returns the x and y position of the object (relative to the client array of the owner object)
control_setSize(control, width,height)
Sets the width and height of the control
control_getSize(control)
Sets the size of the control
control_setAlign(control, alignmentoption)
Sets the alignment of the control
control_getAlign(control, alignmentoption)
Gets the alignment of the control
control_getEnabled(control)
Gets the enabled state of the control
control_setEnabled(control, boolean)
Sets the enabled state of the control
control_getVisible(control)
Gets the visible state of the control
control_setVisible(control, boolean)
Sets the visible state of the control
control_getColor(control)
Gets the color
control_setColor(control, rgb)
Sets the color
control_getParent(control)
Returns nil or an object that inherits from the Wincontrol class
control_setParent(control)
Sets the parent for this control
control_getPopupMenu(control)
Gets the assigned popup menu to this control
control_setPopupMenu(control)
Sets the popup menu for this control
control_onClick(control, functionnameorstring)
Sets the onclick routine function (sender)
--Example: local forms = createForm() local labels = createLabel(forms) --Caption control_setCaption(labels, "My first label") local variable = control_getCaption(labels) print(variable) --Position control_setPosition(labels,30,30) x,y=control_getPosition(labels) print("X coord of label is "..x.."; Y coord of label is "..y) --Enabled? local editbox1 = createEdit(forms) local editbox2 = createEdit(forms) control_setEnabled(editbox1,false) if control_getEnabled(editbox1) then else print "editbox1 not enabled" control_setCaption(editbox1,"editbox1") end control_setEnabled(editbox2,true) if control_getEnabled(editbox2) then print "editbox2 enabled" control_setCaption(editbox2,"editbox2") end control_setPosition(editbox1,30,60) control_setPosition(editbox2,30,90)