DgsComboBoxGetItemData

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

This function gets an Item Data associated to a combo box item.

Syntax

mixed dgsComboBoxGetItemData ( element combobox, int itemIndex )

Required Arguments

  • combobox: the combobox containing the item you're interested in.
  • itemIndex: the item index of the item.

Returns

Returns the item data of the specified item, false otherwise.

Example

This example displays a random item data from the combobox.

DGS = exports.dgs
function clientsideResourceStart ()
    local numberList = DGS:dgsCreateComboBox ( 10,270,150,30,"test",false )
    local item = DGS:dgsComboBoxAddItem ( numberList )
    local myItem = DGS:dgsComboBoxSetItemText ( numberList, item, tostring( math.random(0, 10) ^ 100 ) )
    DGS:dgsComboBoxSetItemData( numberList, item, "Test" )
    local myItemData = DGS:dgsComboBoxGetItemData( numberList, item )
    outputChatBox ( "My combobox item data: " .. myItemData )
end
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )

Syntax

mixed dgsComboBoxGetItemData ( element combobox, int itemIndex, mixed key )

Required Arguments

  • combobox: the combobox containing the item you're interested in.
  • itemIndex: the item index of the item.
  • key: the key you wish to retrieve the data with.

Returns

Returns the item data of the specified item, false otherwise.

Example

This example displays a random item data from the combobox.

DGS = exports.dgs
function clientsideResourceStart ()
    local numberList = DGS:dgsCreateComboBox ( 10,270,150,30,"test",false )
    local item = DGS:dgsComboBoxAddItem ( numberList )
    local myItem = DGS:dgsComboBoxSetItemText ( numberList, item, tostring( math.random(0, 10) ^ 100 ) )
    DGS:dgsComboBoxSetItemData( numberList, item, "myKey", "Test" )
    local myItemData = DGS:dgsComboBoxGetItemData( numberList, item, "myKey" )
    outputChatBox ( "My combobox item data: " .. myItemData )
end
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )

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

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