DgsCheckBoxSetSelected: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 20: Line 20:
DGS = exports.dgs
DGS = exports.dgs


checkedBox = DGS:DgsDxCreateCheckBox(20,30,150,20,"Checked checkbox",true,false)
checkedBox = DGS:dgsDxCreateCheckBox(20,30,150,20,"Checked checkbox",true,false)
uncheckedBox = DGS:DgsDxCreateCheckBox(20,30,150,20,"UnChecked checkbox",false,false)
uncheckedBox = DGS:dgsDxCreateCheckBox(20,30,150,20,"UnChecked checkbox",false,false)


if(DgsDxCheckBoxGetSelected(checkedBox))then
if(DgsDxCheckBoxGetSelected(checkedBox))then
DGS:DgsDxCheckBoxSetSelected(uncheckedBox,true)
DGS:dgsDxCheckBoxSetSelected(uncheckedBox,true)
else
else
DGS:DgsDxCheckBoxSetSelected(checkedBox,true)
DGS:dgsDxCheckBoxSetSelected(checkedBox,true)
end
end
</syntaxhighlight>
</syntaxhighlight>
==See Also==
==See Also==
{{DGSFUNCTIONS}}
{{DGSFUNCTIONS}}

Revision as of 14:15, 2 November 2017

This function selects (ticks) or unselects a checkbox.

Syntax

bool DgsDxCheckBoxSetSelected ( element theCheckbox, bool state )

Required Arguments

  • theCheckbox: The dgs element in which you wish to change the selection state of
  • state: The state of the checkbox, where true indicates selected, false indicates unselected, and nil indicates indeterminate.

Returns

Returns true if the checkbox's selection state was successfully set, false otherwise.

Example

This example creates 2 checkboxes and sets one of them selected then checks if the first one is selected and if it is then the second one would be set selected.

DGS = exports.dgs

checkedBox = DGS:dgsDxCreateCheckBox(20,30,150,20,"Checked checkbox",true,false)
uncheckedBox = DGS:dgsDxCreateCheckBox(20,30,150,20,"UnChecked checkbox",false,false)

if(DgsDxCheckBoxGetSelected(checkedBox))then
	DGS:dgsDxCheckBoxSetSelected(uncheckedBox,true)
else
	DGS:dgsDxCheckBoxSetSelected(checkedBox,true)
end

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