GuiEditSetReadOnly: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (OOP syntax)
 
Line 6: Line 6:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool guiEditSetReadOnly ( element editField, bool status )
bool guiEditSetReadOnly ( element editField, bool status )
</syntaxhighlight>  
</syntaxhighlight>
{{OOP||[[Element/GUI/Edit_field|GuiEdit]]:setReadOnly|readOnly|guiEditIsReadOnly}}


===Required Arguments===  
===Required Arguments===  

Latest revision as of 20:57, 7 November 2018

This function allows you to set or remove read-only status for an edit box. If read-only is set to true, the box is not editable.

Syntax

bool guiEditSetReadOnly ( element editField, bool status )

OOP Syntax Help! I don't understand this!

Method: GuiEdit:setReadOnly(...)
Variable: .readOnly
Counterpart: guiEditIsReadOnly


Required Arguments

  • editField: The element of the edit field to be modified.
  • status: A boolean value indicating whether read-only is to be enabled or disabled.

Returns

Returns true if edit field's read-only status was changed successfully, false otherwise.

Example

This example creates a little advert field on the bottom right corner of the screen and sets it to read only.

myWebsite = "development.mtasa.com" -- define the text to be displayed in advert field
function createAdvert( )
    local advert = guiCreateEdit( 0.845, 0.94, 0.15, 0.05, myWebsite, true ) -- create edit field for the advert
    if advert then -- if it was successfully created
        guiEditSetReadOnly( advert, true ) -- make it read only
    end
end
addEventHandler ( "onClientResourceStart", getResourceRootElement( getThisResource() ), createAdvert )

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