GuiMemoSetReadOnly: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(someone forget to add oop syntax)
(6 intermediate revisions by 4 users not shown)
Line 7: Line 7:
bool guiMemoSetReadOnly ( gui-memo theMemo, bool status )
bool guiMemoSetReadOnly ( gui-memo theMemo, bool status )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[Element/GUI/Memo_field|GuiMemo]]:setReadOnly|readOnly|guiMemoIsReadOnly}}


===Required Arguments===  
===Required Arguments===  
Line 16: Line 17:


==Example==  
==Example==  
[[Category:Needs Example]]
{{Client function}}
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), -- only execute the code when this resource restarts
function memo()
function( )
memo = guiCreateMemo(500, 500, 500, 500, "This is a memo", false)-- We created a memo.
memo = guiCreateMemo( 0.4, 0.4, 0.2, 0.2, "This is a memo.", true ) -- create a relative memo GUI element
guiMemoSetReadOnly(memo, true)--We made it read only.
guiMemoSetReadOnly( memo, true ) -- make it read only, so players won't be able to edit it in-game
end
end
addEventHandler("onClientResourceStart", getRootElement(), memo)--We handle our memo.</syntaxhighlight>
)</syntaxhighlight>


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

Revision as of 19:55, 8 March 2020

This function allows you to set or remove read-only status for a GUI memo. If read-only is set to true, the contents are not editable.

Syntax

bool guiMemoSetReadOnly ( gui-memo theMemo, bool status )

OOP Syntax Help! I don't understand this!

Method: GuiMemo:setReadOnly(...)
Variable: .readOnly
Counterpart: guiMemoIsReadOnly


Required Arguments

  • theMemo: The memo to change read-only status of.
  • status: A boolean value indicating whether read-only is to be enabled or disabled.

Returns

Returns true if the status was successfully changed, false otherwise.

Example

addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), -- only execute the code when this resource restarts
	function( )
		memo = guiCreateMemo( 0.4, 0.4, 0.2, 0.2, "This is a memo.", true ) -- create a relative memo GUI element
		guiMemoSetReadOnly( memo, true ) -- make it read only, so players won't be able to edit it in-game
	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