GuiEditIsReadOnly: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} __NOTOC__ {{New feature/item|3.0156|1.5.5|12419|This function checking if edit field is read only or no.}} ==Syntax== <syntaxhighlight lang="lua"> bool...")
 
mNo edit summary
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__  
__NOTOC__  
{{New feature/item|3.0156|1.5.5|12419|This function checking if edit field is read only or no.}}
{{New feature/item|3.0156|1.5.5|12419|This function checks if an edit field is read-only.}}


==Syntax==  
==Syntax==  
Line 12: Line 12:


===Returns===
===Returns===
Returns ''true'' if editField is read only, ''false'' if editField isn't read only, ''nil'' otherwise.
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.


==Example==  
==Example==  
{{Client function}}
{{Client function}}
<syntaxhighlight lang="lua">myWebsite = "development.mtasa.com" -- define the text to be displayed in advert field
<syntaxhighlight lang="lua">
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 field for the advert
Line 22: Line 23:
         guiEditSetReadOnly( advert, true ) -- make it read only
         guiEditSetReadOnly( advert, true ) -- make it read only
     end
     end
     addCommandHandler("isReadOnly",function()
     addCommandHandler( "isReadOnly",
        local readOnly = guiEditIsReadOnly(advert) -- check editField status
        function( )
        outputChatBox("Edit readOnly: "..readOnly) -- show info about editField
            local readOnly = guiEditIsReadOnly( advert ) -- check editField status
     end)
            outputChatBox( "Edit readOnly: " .. readOnly ) -- show info about editField
        end
     )
end
end
addEventHandler ( "onClientResourceStart", getResourceRootElement( getThisResource() ), createAdvert )</syntaxhighlight>
addEventHandler( "onClientResourceStart", resourceRoot, createAdvert )</syntaxhighlight>


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

Revision as of 17:37, 24 July 2018

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

Syntax

bool guiEditIsReadOnly ( gui-edit editField )

Required Arguments

  • editField: The gui-edit to check read-only status of.

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.

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 field 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 editField status
            outputChatBox( "Edit readOnly: " .. readOnly ) -- show info about editField
        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