- Documentation
- Interface (GUI)
Category
Interface (GUI)
All Lua functions and events in the Interface (GUI) category, on the server and the client.
Client functions 145
guiRemoves focus from a control, so typing no longer goes to it.Blur guiBrings a window or control to the front.Bring To Front guiChecks whether a check box is checked.Check Box Get Selected guiChecks or unchecks a check box.Check Box Set Selected guiAdds an item to a drop-down list.Combo Box Add Item guiRemoves all items from a drop-down list.Combo Box Clear guiReturns the number of items in a drop-down list.Combo Box Get Item Count guiReturns the text of a drop-down item.Combo Box Get Item Text guiReturns the selected item index (from 0), orCombo Box Get Selected -1when nothing is selected.guiChecks whether a drop-down list is open.Combo Box Is Open guiRemoves an item from a drop-down list.Combo Box Remove Item guiChanges the text of a drop-down item.Combo Box Set Item Text guiOpens or closes a drop-down list.Combo Box Set Open guiSelects a drop-down item.Combo Box Set Selected -1clears the selection.guiCreates a browser as a GUI control. Mouse, wheel and keyboard go to the page by themselves. Get the browser element forCreate Browser loadBrowserURLwithguiGetBrowser.guiCreates a button. A click firesCreate Button onClientGUIClick.guiCreates a check box (yes/no).Create Check Box guiCreates a drop-down list. Choosing an item firesCreate Combo Box onClientGUIComboBoxAccepted.guiCreates a single-line text field. Changing the text firesCreate Edit onClientGUIChanged, Enter firesonClientGUIAccepted.guiCreates a font from a resource TTF file forCreate Font guiSetFont. Size in points.guiCreates a list with columns (a table). Add columns withCreate Grid List guiGridListAddColumnand rows withguiGridListAddRow.guiCreates a text label.Create Label guiCreates a multi-line text field.Create Memo guiCreates a progress bar (0-100).Create Progress Bar guiCreates a radio button for choosing one option of a group. Buttons with the same parent form a group.Create Radio Button guiCreates a scroll bar (0-100). Moving it firesCreate Scroll Bar onClientGUIScroll.guiCreates a scrollable area. Child controls that do not fit can be scrolled.Create Scroll Pane guiCreates a value slider 0-100. Changing it firesCreate Slider onClientGUIChanged.guiCreates an image from a resource file (PNG, JPG). The file must be listed inCreate Static Image meta.xml.guiAdds a tab to a panel. The tab is the parent of its controls.Create Tab guiCreates a tab panel. Add tabs withCreate Tab Panel guiCreateTab.guiCreates a window with a title bar. The window can be dragged and resized and has a close button (theCreate Window onClientGUICloseevent). Add other controls as its children.guiRemoves a tab from a panel together with its controls.Delete Tab guiReturns the text cursor position in a field (number of characters before it).Edit Get Caret Index guiReturns the maximum number of characters that can be typed in a field.Edit Get Max Length guiChecks whether a field hides its text with asterisks.Edit Is Masked guiChecks whether a field is read-only.Edit Is Read Only guiSets the text cursor position in a field.Edit Set Caret Index guiHides the typed text with asterisks, e.g. for a password.Edit Set Masked guiSets the maximum number of characters in a field.Edit Set Max Length guiMakes a field read-only (it cannot be typed into).Edit Set Read Only guiFocuses a control, so typing goes to it.Focus guiReturns a control's alpha (0-1).Get Alpha guiReturns the browser element from aGet Browser guiCreateBrowsercontrol.guiReturns the cursor type matching the control under the mouse:Get Cursor Type "default","text"or"sizing".guiChecks whether a control responds to mouse and keyboard.Get Enabled guiReturns the focused control (the one that receives typing).Get Focus guiReturns a control's font (a name or a handle fromGet Font guiCreateFont).guiChecks whether the interface takes the keyboard from the game.Get Input Enabled guiReturns the interface input mode:Get Input Mode "allow_binds","no_binds"or"no_binds_when_editing".guiReturns a control's position relative to its parent.Get Position guiReturns all control properties, including built-in ones (kind, text, position, size...). Useful for debugging.Get Properties guiReturns a custom control property set withGet Property guiSetProperty.guiReturns the current GUI scale.Get Scale guiReturns the screen size in pixels.Get Screen Size guiReturns the selected tab of a panel.Get Selected Tab guiReturns a control's size.Get Size guiReturns a control's text (label, button, field, window title).Get Text guiReturns the current theme name and, as a second result, its drawing colours.Get Theme guiReturns one colour of the current theme.Get Theme Color guiReturns the names of available themes (sorted).Get Theme Names guiChecks whether a control is visible.Get Visible guiReturns all top-level controls (windows and controls without a parent). Useful for debugging.Get Widgets guiAdds a column to a list. Width is a fraction of the list width.Grid List Add Column guiAdds a row. You can pass the texts of the following cells right away as extra arguments.Grid List Add Row guiFits a column's width to its longest cell.Grid List Auto Size Column guiRemoves all rows from a list (columns stay).Grid List Clear guiReturns the number of list columns.Grid List Get Column Count guiReturns a column header.Grid List Get Column Title guiReturns a column's width.Grid List Get Column Width guiReturns how far the list is scrolled horizontally (0-100).Grid List Get Horizontal Scroll Position guiReturns a cell's text colour.Grid List Get Item Color guiReturns the value attached to a cell withGrid List Get Item Data guiGridListSetItemData.guiReturns a cell's text.Grid List Get Item Text guiReturns the number of list rows.Grid List Get Row Count guiReturns the number of selected rows (0 or 1; the list selects one row).Grid List Get Selected Count guiReturns the selected row (from 0) and column (from 1). When nothing is selected:Grid List Get Selected Item -1, -1.guiReturns the selected cells asGrid List Get Selected Items {row = ..., column = ...}tables.guiReturns the row selection mode stored withGrid List Get Selection Mode guiGridListSetSelectionMode.guiReturns how far the list is scrolled vertically (0-100).Grid List Get Vertical Scroll Position guiInserts a row after the given one.Grid List Insert Row After -1inserts at the top.guiChecks whether clicking a header sorts the list (yes by default).Grid List Is Sorting Enabled guiRemoves a column together with its cells.Grid List Remove Column guiRemoves a row.Grid List Remove Row guiChanges a column header.Grid List Set Column Title guiSets a column's width.Grid List Set Column Width guiScrolls the list horizontally (0-100).Grid List Set Horizontal Scroll Position guiSets a cell's text colour.Grid List Set Item Color guiAttaches any value invisible to the player to a cell, e.g. an element or a model number.Grid List Set Item Data guiSets a cell's text. WithGrid List Set Item Text section = truethe row becomes a section header.guiSets whether the list shows scroll bars.Grid List Set Scroll Bars guiSelects a list row.Grid List Set Selected Item -1clears the selection. FiresonClientGUIChanged.guiStores the selection mode (a number). The list always selects one row.Grid List Set Selection Mode guiTurns sorting by clicking a header on or off.Grid List Set Sorting Enabled guiScrolls the list vertically (0-100).Grid List Set Vertical Scroll Position guiSorts the list by a column. Numbers are compared as numbers, the rest as text. Clears the selection.Grid List Sort By Column guiReturns a label's colour.Label Get Color guiReturns a label's font height in pixels.Label Get Font Height guiReturns the width of a label's text in pixels.Label Get Text Extent guiSets a label's colour.Label Set Color guiAligns a label's text horizontally and optionally wraps lines.Label Set Horizontal Align guiAligns a label's text vertically.Label Set Vertical Align guiReturns the cursor position in a multi-line field. Another name forMemo Get Caret Index guiEditGetCaretIndex.guiReturns how far a multi-line field is scrolled (0-100).Memo Get Vertical Scroll Position guiChecks whether a multi-line field is read-only. Another name forMemo Is Read Only guiEditIsReadOnly.guiSets the cursor position in a multi-line field. Another name forMemo Set Caret Index guiEditSetCaretIndex.guiMakes a multi-line field read-only. Another name forMemo Set Read Only guiEditSetReadOnly.guiScrolls a multi-line field (0-100).Memo Set Vertical Scroll Position guiShows a dialog with buttons. On click it firesMessage Box onClientGUIAccepted(source: the window, arguments: the button text and its number), then the window closes.guiMoves a window behind the others.Move To Back guiShows a short notification in the bottom-right corner of the screen. At most 6 are shown at once.Notify guiReturns a progress bar's progress (0-100).Progress Bar Get Progress guiSets a progress bar's progress (0-100).Progress Bar Set Progress guiChecks whether a radio button is selected.Radio Button Get Selected guiSelects a radio button in its group (the others are deselected).Radio Button Set Selected guiAdds your own theme. Missing colours are taken from the current theme.Register Theme guiReturns a scroll bar's position (0-100).Scroll Bar Get Scroll Position guiSets a scroll bar's position (0-100).Scroll Bar Set Scroll Position guiReturns how far an area is scrolled horizontally (0-100).Scroll Pane Get Horizontal Scroll Position guiReturns how far an area is scrolled vertically (0-100).Scroll Pane Get Vertical Scroll Position guiScrolls an area horizontally (0-100).Scroll Pane Set Horizontal Scroll Position guiSets whether an area shows scroll bars.Scroll Pane Set Scroll Bars guiScrolls an area vertically (0-100).Scroll Pane Set Vertical Scroll Position guiSets a control's alpha (0 invisible, 1 opaque).Set Alpha guiEnables or disables a control. A disabled one is greyed out and does not respond.Set Enabled guiSets a control's font: a built-in name (Set Font "default-normal","default-small","default-bold-small","default-bold","clear-normal","sa-header","sa-gothic") or a handle fromguiCreateFont.guiGives the keyboard to the interface instead of the game (the character ignores keys and binds do not fire).Set Input Enabled guiSets the input mode:Set Input Mode "allow_binds"(binds work),"no_binds"(they do not) or"no_binds_when_editing"(they do not while typing in a field).guiMoves a control. FiresSet Position onClientGUIMove.guiSets a control property. Supported:Set Property "CloseButtonEnabled"(the window close button) and"AlwaysOnTop"; other names are stored for the script.guiSets the scale of the whole GUI (0.5-4, default 1): fonts, the title bar, list and tab rows. Control positions and sizes stay in script pixels.Set Scale guiSelects a panel tab.Set Selected Tab guiResizes a control. FiresSet Size onClientGUISize.guiChanges a control's text.Set Text guiChanges the theme of the whole interface: a name (Set Theme default,sunset,midnight,ocean,emerald,crimson,grape,slate,lightor your own fromguiRegisterTheme) or a table of colours.guiChanges one colour of the current theme. Keys:Set Theme Color accent,accentBright,accentDim,accentText,windowBg,windowBorder,titleBg,titleBgActive,panelBg,fieldBg,fieldBorder,text,textDim,textDisabled,hover,press,shadow,scrollTrack,scrollThumb.guiShows or hides a control together with its children.Set Visible guiReturns a slider's value (0-100).Slider Get Value guiSets a slider's value (0-100).Slider Set Value guiReturns the real pixel size of the image file.Static Image Get Native Size guiReplaces the image file of the control.Static Image Load Image guiChecks whether a window can be dragged.Window Is Movable guiChecks whether a window can be resized.Window Is Sizable guiSets whether a window can be dragged with the mouse.Window Set Movable guiSets whether a window can be resized by dragging its edge.Window Set Sizable
Client events 16
onThe player confirmed a GUI edit box with Enter.Client GUIAccepted onA GUI control lost focus.Client GUIBlur onThe text in a GUI edit box or memo changed.Client GUIChanged onThe player clicked a GUI control (a button, a field, a list).Client GUIClick onThe player closed a GUI window with the close button.Client GUIClose onThe player picked an item from a GUI combo box.Client GUICombo Box Accepted onThe player double-clicked a GUI control (e.g. a list row).Client GUIDouble Click onA GUI control got focus (e.g. an edit box the player clicks into).Client GUIFocus onThe player pressed a mouse button over a GUI control.Client GUIMouse Down onThe player released a mouse button over a GUI control.Client GUIMouse Up onThe player moved a GUI window.Client GUIMove onA GUI scroll bar was moved.Client GUIScroll onThe player resized a GUI window.Client GUISize onThe player switched a tab in a GUI tab panel.Client GUITab Switched onThe cursor moved over a GUI control. Useful for highlights and tooltips.Client Mouse Enter onThe cursor left a GUI control.Client Mouse Leave