Lua:Class:Control
Jump to navigation
Jump to search
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: function clickroutine(sender) -- onClick() print "editbox2 clicked" end 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) --Visibility local editbox3 = createEdit(forms) control_setVisible(editbox3, true) -- If false editbox3 would not be displayed on the form. if control_getVisible(editbox3) then control_setCaption(editbox3,"editbox3") -- Sets the caption only when visible control_setPosition(editbox3,30,120) end --Color control_setColor(labels, 123456) -- color code in hex (range 000000 to FFFFFF) local colorCode = control_getColor(labels) print(colorCode) --Onclick control_onClick(editbox2,clickroutine) -- clickroutine must have exactly one argument