GuiMemoGetCaretIndex: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(Add missing OOP info)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Client function}}
{{Client function}}
{{Needs Example}}
__NOTOC__
__NOTOC__
{{New feature/item|3.0135|1.3.5|6054|
{{New feature/item|3.0135|1.3.5|6054|
Line 10: Line 9:
int guiMemoGetCaretIndex ( element theElement )
int guiMemoGetCaretIndex ( element theElement )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[GuiMemo]]:getCaretIndex|caretIndex|guiMemoSetCaretIndex}}


===Required Arguments===  
===Required Arguments===  
Line 18: Line 18:


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


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

Latest revision as of 13:54, 10 August 2021

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

Syntax

int guiMemoGetCaretIndex ( element theElement )

OOP Syntax Help! I don't understand this!

Method: GuiMemo:getCaretIndex(...)
Variable: .caretIndex
Counterpart: guiMemoSetCaretIndex


Required Arguments

  • theElement: The memo 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 memo to the chat

local memo = guiCreateMemo(0.4,0.1,0.3,0.3,"",true)

addEventHandler("onClientGUIChanged",memo,function()
	outputChatBox("Caret index is: "..guiMemoGetCaretIndex(memo)) -- 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

Input

GUI