GuiSetInputEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 19: Line 19:


==Example==  
==Example==  
This example enables or disables the Input.
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Todo..
function setInputState()
guiSetInputEnabled(not guiGetInputEnabled()) -- Disable the Input if Enabled, either Enable it.
outputChatBox("The input is now ".. (guiGetInputEnabled() and "Enabled" or "Disabled") ..".") -- Output the new Input state.
end
addCommandHandler("input",setInputState) -- Add the command handler attached to the function "setInputState".
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 23:16, 28 January 2012

This function enables or disables input focus for the GUI. This means that any keybinds or MTA binds are overidden so that text can be input into an editbox, for example. In other words, keys such as t and y which activate the chatbox are disabled.

guiSetInputMode can be used as an extended version of guiSetInputEnabled since it provides the same functionality with one added feature.

Syntax

bool guiSetInputEnabled ( bool enabled )

Required Arguments

  • enabled: true if input should go to GUI, false if it should go to the game.

Returns

Returns true if input mode could be changed, false if invalid parameters are passed.

Example

This example enables or disables the Input.

Click to collapse [-]
Client
function setInputState()
	guiSetInputEnabled(not guiGetInputEnabled()) -- Disable the Input if Enabled, either Enable it.
	outputChatBox("The input is now ".. (guiGetInputEnabled() and "Enabled" or "Disabled") ..".") -- Output the new Input state.
end
addCommandHandler("input",setInputState) -- Add the command handler attached to the function "setInputState".

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows