GuiEditIsReadOnly: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__  
__NOTOC__  
{{New feature/item|3.0156|1.5.5|12419|This function checks if an edit field is read-only.}}
{{New feature/item|3.0156|1.5.5|12419|This function checks if an edit box is read-only.}}


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool guiEditIsReadOnly ( gui-edit editField )
bool guiEditIsReadOnly ( gui-edit guiEdit )
</syntaxhighlight>  
</syntaxhighlight>
{{OOP|||readOnly|guiEditSetReadOnly}}


===Required Arguments===  
===Required Arguments===  
*'''editField:''' The gui-edit to check read-only status of.
*'''guiEdit:''' The edit box to check read-only status of.


===Returns===
===Returns===
Returns ''true'' if the edit field is read-only, ''false'' if edit field isn't read only, ''nil'' if an invalid edit field was provided.
Returns ''true'' if the edit box is read-only, ''false'' if not, ''nil'' if an invalid edit box was provided.


==Example==  
==Example==  
Line 19: Line 20:
local myWebsite = "development.mtasa.com" -- define the text to be displayed in advert field
local myWebsite = "development.mtasa.com" -- define the text to be displayed in advert field
function createAdvert( )
function createAdvert( )
     local advert = guiCreateEdit( 0.845, 0.94, 0.15, 0.05, myWebsite, true ) -- create edit field for the advert
     local advert = guiCreateEdit( 0.845, 0.94, 0.15, 0.05, myWebsite, true ) -- create edit box for the advert
     if advert then -- if it was successfully created
     if advert then -- if it was successfully created
         guiEditSetReadOnly( advert, true ) -- make it read only
         guiEditSetReadOnly( advert, true ) -- make it read-only
     end
     end
     addCommandHandler( "isReadOnly",
     addCommandHandler( "isReadOnly",
         function( )
         function( )
             local readOnly = guiEditIsReadOnly( advert ) -- check editField status
             local readOnly = guiEditIsReadOnly( advert ) -- check edit box status
             outputChatBox( "Edit readOnly: " .. readOnly ) -- show info about editField
             outputChatBox( "Edit box is " .. ( readOnly and "read-only" or "not read-only" ) ) -- show info about edit box
         end
         end
     )
     )

Latest revision as of 20:57, 7 November 2018

This function checks if an edit box is read-only.

Syntax

bool guiEditIsReadOnly ( gui-edit guiEdit )

OOP Syntax Help! I don't understand this!

Variable: .readOnly
Counterpart: guiEditSetReadOnly


Required Arguments

  • guiEdit: The edit box to check read-only status of.

Returns

Returns true if the edit box is read-only, false if not, nil if an invalid edit box was provided.

Example

local 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 box for the advert
    if advert then -- if it was successfully created
        guiEditSetReadOnly( advert, true ) -- make it read-only
    end
    addCommandHandler( "isReadOnly",
        function( )
            local readOnly = guiEditIsReadOnly( advert ) -- check edit box status
            outputChatBox( "Edit box is " .. ( readOnly and "read-only" or "not read-only" ) ) -- show info about edit box
        end
    )
end
addEventHandler( "onClientResourceStart", resourceRoot, 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