DgsEditSetTextFilter: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 10: Line 10:
===Required Arguments===  
===Required Arguments===  
*'''edit:''' the dgs edit you want to set.
*'''edit:''' the dgs edit you want to set.
*'''whitelist:''' the pattern (regular expression).
*'''whitelist:''' the pattern (refer to lua pattern).


===Returns===
===Returns===

Revision as of 07:19, 2 October 2019

This function sets the white list of edit text. White List in edit means every character of the text should meet the requirement of the white list, or the characters will be cut.

Syntax

bool dgsEditSetWhiteList( element edit, string whitelist )

Required Arguments

  • edit: the dgs edit you want to set.
  • whitelist: the pattern (refer to lua pattern).

Returns

Returns true if succeeded, false otherwise.

Example

DGS = exports.dgs

local edit = DGS:dgsCreateEdit(0.3,0.3,0.2,0.05,"",true)
DGS:dgsEditSetWhiteList(edit ,"[^a-zA-Z0-9$]") --This regular expression set a restrict that the character of text allowed is from "a" to "z", "A" to "Z" and 0 to 9

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

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips