GuiSetInputMode: Difference between revisions
Jump to navigation
Jump to search
FeaturedPro (talk | contribs) (Improve input mode descriptions) |
|||
(9 intermediate revisions by 5 users not shown) | |||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
This function controls the input mode to define whether or not (and when) keybinds or MTA binds are overridden (disabled) so that text can be input into an editbox, for example. | This function controls the input mode to define whether or not (and when) keybinds or MTA binds are overridden (disabled) so that text can be input into an editbox, for example. | ||
Available input modes are: | |||
* never disabled (hence using a key such as t in an editbox will still | * '''allow_binds:''' never disabled (hence using a key such as t in an editbox will still open the chatbox) | ||
* always disabled (hence using a key such as t | * '''no_binds:''' always disabled (hence using a key such as t will never open the chatbox) | ||
* only disabled when | * '''no_binds_when_editing:''' only disabled when editing an editbox or a memo (binds are enabled except when an editbox or memo has input focus) | ||
==Syntax== | ==Syntax== | ||
Line 11: | Line 11: | ||
bool guiSetInputMode ( string mode ) | bool guiSetInputMode ( string mode ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[GUI widgets|GuiElement]].setInputMode|inputMode|guiGetInputMode}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
* '''mode:''' a string representing the desired input mode. Accepted values are: | * '''mode:''' a string representing the desired input mode. Accepted values are: | ||
** '''"allow_binds":''' binds are enabled, hence using a key such as t in an editbox will still | ** '''"allow_binds":''' binds are enabled, hence using a key such as t in an editbox will still open the chatbox (default) | ||
** '''"no_binds":''' binds are disabled, hence using a key such as t | ** '''"no_binds":''' binds are disabled, hence using a key such as t will never open the chatbox | ||
** '''"no_binds_when_editing":''' binds are | ** '''"no_binds_when_editing":''' binds are enabled except when an editbox or memo has input focus | ||
===Returns=== | ===Returns=== | ||
Line 22: | Line 23: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function onClientResourceStartSetGUIInputMode() | |||
function() | guiSetInputMode("no_binds_when_editing") -- Calls guiSetInputMode once and for all to not have to handle binds state dynamically | ||
guiSetInputMode("no_binds_when_editing") --Calls guiSetInputMode once and for all to not have to handle binds state dynamically | end | ||
end) | addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStartSetGUIInputMode) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Note== | ==Note== | ||
Line 38: | Line 37: | ||
==See Also== | ==See Also== | ||
{{GUI_functions}} | {{GUI_functions}} | ||
{{GUI_events}} |
Latest revision as of 18:30, 31 May 2024
This function controls the input mode to define whether or not (and when) keybinds or MTA binds are overridden (disabled) so that text can be input into an editbox, for example. Available input modes are:
- allow_binds: never disabled (hence using a key such as t in an editbox will still open the chatbox)
- no_binds: always disabled (hence using a key such as t will never open the chatbox)
- no_binds_when_editing: only disabled when editing an editbox or a memo (binds are enabled except when an editbox or memo has input focus)
Syntax
bool guiSetInputMode ( string mode )
OOP Syntax Help! I don't understand this!
- Method: GuiElement.setInputMode(...)
- Variable: .inputMode
- Counterpart: guiGetInputMode
Required Arguments
- mode: a string representing the desired input mode. Accepted values are:
- "allow_binds": binds are enabled, hence using a key such as t in an editbox will still open the chatbox (default)
- "no_binds": binds are disabled, hence using a key such as t will never open the chatbox
- "no_binds_when_editing": binds are enabled except when an editbox or memo has input focus
Returns
Returns true if input mode could be changed, false if invalid parameters are passed.
Example
function onClientResourceStartSetGUIInputMode() guiSetInputMode("no_binds_when_editing") -- Calls guiSetInputMode once and for all to not have to handle binds state dynamically end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStartSetGUIInputMode)
Note
This function, introduced in 1.1, can be used as a replacement of guiSetInputEnabled since it provides the same functionality with one added feature.
- guiSetInputEnabled ( false ) is the same as guiSetInputMode ( "allow_binds" )
- guiSetInputEnabled ( true ) is the same as guiSetInputMode ( "no_binds" )
See Also
General functions
- guiBringToFront
- getChatboxLayout
- getChatboxCharacterLimit
- guiCreateFont
- guiBlur
- guiFocus
- guiGetAlpha
- guiGetCursorType
- guiGetEnabled
- guiGetFont
- guiGetInputEnabled
- guiGetInputMode
- guiGetPosition
- guiGetProperties
- guiGetProperty
- guiGetScreenSize
- guiGetSize
- guiGetText
- guiGetVisible
- guiMoveToBack
- guiSetAlpha
- guiSetEnabled
- guiSetFont
- guiSetInputEnabled
- guiSetInputMode
- guiSetPosition
- guiSetProperty
- guiSetSize
- guiSetText
- guiSetVisible
- isChatBoxInputActive
- isConsoleActive
- isDebugViewActive
- isMainMenuActive
- isMTAWindowActive
- isTransferBoxActive
- setChatboxCharacterLimit
- setDebugViewActive
Browsers
Buttons
Checkboxes
Comboboxes
- guiCreateComboBox
- guiComboBoxAddItem
- guiComboBoxClear
- guiComboBoxGetItemCount
- guiComboBoxGetItemText
- guiComboBoxGetSelected
- guiComboBoxIsOpen
- guiComboBoxRemoveItem
- guiComboBoxSetItemText
- guiComboBoxSetOpen
- guiComboBoxSetSelected
Edit Boxes
- guiCreateEdit
- guiEditGetCaretIndex
- guiEditGetMaxLength
- guiEditIsMasked
- guiEditIsReadOnly
- guiEditSetCaretIndex
- guiEditSetMasked
- guiEditSetMaxLength
- guiEditSetReadOnly
Gridlists
- guiCreateGridList
- guiGridListAddColumn
- guiGridListAddRow
- guiGridListAutoSizeColumn
- guiGridListClear
- guiGridListGetColumnCount
- guiGridListGetColumnTitle
- guiGridListGetColumnWidth
- guiGridListGetHorizontalScrollPosition
- guiGridListGetItemColor
- guiGridListGetItemData
- guiGridListGetItemText
- guiGridListGetRowCount
- guiGridListGetSelectedCount
- guiGridListGetSelectedItem
- guiGridListGetSelectedItems
- guiGridListGetSelectionMode
- guiGridListIsSortingEnabled
- guiGridListGetVerticalScrollPosition
- guiGridListInsertRowAfter
- guiGridListRemoveColumn
- guiGridListRemoveRow
- guiGridListSetColumnTitle
- guiGridListSetColumnWidth
- guiGridListSetHorizontalScrollPosition
- guiGridListSetItemColor
- guiGridListSetItemData
- guiGridListSetItemText
- guiGridListSetScrollBars
- guiGridListSetSelectedItem
- guiGridListSetSelectionMode
- guiGridListSetSortingEnabled
- guiGridListSetVerticalScrollPosition
Memos
- guiCreateMemo
- guiMemoGetCaretIndex
- guiMemoGetVerticalScrollPosition
- guiMemoSetVerticalScrollPosition
- guiMemoIsReadOnly
- guiMemoSetCaretIndex
- guiMemoSetReadOnly
Progressbars
Radio Buttons
Scrollbars
Scrollpanes
- guiCreateScrollPane
- guiScrollPaneGetHorizontalScrollPosition
- guiScrollPaneGetVerticalScrollPosition
- guiScrollPaneSetHorizontalScrollPosition
- guiScrollPaneSetScrollBars
- guiScrollPaneSetVerticalScrollPosition
Static Images
Tab Panels
Tabs
Text Labels
- guiCreateLabel
- guiLabelGetColor
- guiLabelGetFontHeight
- guiLabelGetTextExtent
- guiLabelSetColor
- guiLabelSetHorizontalAlign
- guiLabelSetVerticalAlign
Windows
Input
GUI
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel