DgsCheckBoxSetSelected

From Multi Theft Auto: Wiki

This function selects (ticks) or unselects a checkbox.

Syntax

bool dgsCheckBoxSetSelected ( 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:dgsCreateCheckBox(20,30,150,20,"Checked checkbox",true,false)
uncheckedBox = DGS:dgsCreateCheckBox(20,30,150,20,"UnChecked checkbox",false,false)

if DGS:dgsCheckBoxGetSelected(checkedBox)then
	DGS:dgsCheckBoxSetSelected(uncheckedBox,true)
else
	DGS:dgsCheckBoxSetSelected(checkedBox,true)
end

See Also

Multi Language Supports

Animation

3D Interface

3D Text

Arrow List

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Ellipse Detect Area

Detect Area

Grid List

Image

Memo

Label

Progress Bar

Radio Button

Scroll Bar

Scroll Pane

Switch Button

Tab Panel

Window

Plugin

Media Browser

Rounded Rectangle

Color Picker

Blur Box

Effect 3D

Nine Slice