DgsEditSetMasked

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function sets or removes masking (covering up the text being typed) for password text fields.

Syntax

bool dgsEditSetMasked ( element theElement, bool status )

Required Arguments

  • theElement: The dgs edit box to be changed.
  • status: A boolean value indicating whether masking is to be enabled or disabled.

Returns

Returns true if the function is successful, false otherwise.

Example

This example creates a dgs edit box and an OK button. The user types in his password, and it checks if the password was correct

DGS = exports.dgs
-- set our password
password = "cheeseman"

-- create our button
button = DGS:dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "OK", true )
-- create a dgs edit box and define it as "editBox"
editBox = DGS:dgsCreateEdit( 0.3, 0.1, 0.4, 0.1, "", true )
-- ensure that it is masked
DGS:dgsEditSetMasked ( editBox, true )

-- set up our function to output the message to the chatbox
function checkPassword ()
        local text = DGS:dgsGetText ( editBox )     -- get the text from the edit box
        if text == password then                -- if the text matches the password
                outputChatBox ( "Password Correct!" )
        else
                outputChatBox ( "Password Incorrect!" )
        end
end
-- set the function to be called when the OK button is clicked
addEventHandler ( "onDgsMouseClick", button, checkPassword )

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Plugin

Blur Box

Canvas

Chart

Circle

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Rounded Rectangle

Screen Source

SVG

Tooltips