-
Notifications
You must be signed in to change notification settings - Fork 1
AddonLibForms
Angelo Geels edited this page Dec 26, 2015
·
4 revisions
Provides functions to create user interfaces. Parameters shown with a value are default values (if you don't supply them).
-
forms:form(style = 'sizable')
Create a new form and return its Form handle. Style can besizable
for a resizable form, orfixedsingle
for a fixed sized form. -
forms:webform(url = 'about:blank', callback<string, string> callback = nil)
Create a new form with a web view on it and return its WebForm handle. (This function requires theNETWORK
permission.) -
forms:label()
Create a new label control and return its Label handle. -
forms:text()
Create a new textbox control and return its Text handle. -
forms:button()
Create a new button control and return its Control handle. -
forms:combo()
Create a new combo control and return its Combo handle. -
forms:check()
Create a new checkbox control and return its Check handle. -
forms:theme(handle)
Apply the application theme to the given Form handle.
This library does not require any permissions.
count = 0
local form = forms:form()
form.text = 'Example form'
form.width = 500
form.height = 300
label = forms:label()
label.left = 6
label.top = 6
label.text = 'Click the button'
label:addtoform(form)
local button = forms:button()
button.left = 6
button.top = 60
button.text = 'Click me'
button:addhandler('click', function(sender, e)
count = count + 1
label.text = 'You clicked the button ' .. count .. ' times'
end)
button:addtoform(form)
forms:theme(form)
form:show()