GuiEditGetCaretIndex: Difference between revisions

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


==Example==
==Example==
<syntaxhighlight lang="lua">Todo</syntaxhighlight>
This example outputs the caret position of the edit field to the chat
<syntaxhighlight lang="lua">
local edit = guiCreateEdit(0.4,0.4,0.3,0.1,"",true)
 
addEventHandler("onClientGUIChanged",edit,function()
outputChatBox("Caret index is: "..guiEditGetCaretIndex(edit)) -- output index to chat
end)
</syntaxhighlight>


==See Also==
==See Also==
{{GUI_functions}}
{{GUI_functions}}

Revision as of 18:00, 11 July 2017

Accessories-text-editor.png Script Example Missing Function GuiEditGetCaretIndex needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.


This function returns the caret (the text cursor) position within the editbox.

Syntax

int guiEditGetCaretIndex ( element theElement )

Required Arguments

  • theElement: The edit box you want to get the caret position from

Returns

Returns the caret index on success, false otherwise.

Example

This example outputs the caret position of the edit field to the chat

local edit = guiCreateEdit(0.4,0.4,0.3,0.1,"",true)

addEventHandler("onClientGUIChanged",edit,function()
	outputChatBox("Caret index is: "..guiEditGetCaretIndex(edit)) -- output index to chat
end)

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