-
Notifications
You must be signed in to change notification settings - Fork 16
GUI Objects
Will Thomas edited this page Mar 28, 2014
·
13 revisions
#Overview Gui objects, created by calling gml.create, are the root elements of any gui you make with gml.
- style The style table to use on this gui. Style table can be loaded with gml.loadStyle(), by default an included default style will be used.
- posX, posY, width, height The position and dimensions of the gui, in screen coordinates.
- gui:run() The function that makes it go. When you're done setting up your gui, this is the function that actually runs it. Will not return unti the gui is closed.
- gui:close() Closes the gui, cleaning up the screen and restoring term to it's state prior to running the gui. At this point gui:run will exit. Can also close the gui by pushing an event "gui_close"
- gui:addHandler(event,function) - adds an event handler. Same as calling event.listen, but the gui will call event.listen when the gui is run, and automatically call gui.ignore to remove it again when the gui closes.
- gui:changeFocusTo(targetElement) Gives focus to the passed gui element, triggering relevant events and redrawing as needed.
- gui:addLabel(x,y,w,text) Adds a label to the gui with the specified properties. Returns the label object.
- gui:addButton(x,y,w,h,label,onClick) Adds a button. onClick is a function to be called when the button is clicked on. Returns the button object.
- gui:addTextField(x,y,w) Adds a textfield object, for entering text.