DgsComboBoxGetItemCount

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

Syntax

int dgsComboBoxGetItemCount ( element comboBox )

Required Arguments

  • comboBox: The combo box to get the number of items from.

Returns

Returns the number of items if the function is successful, false otherwise.

Example

This example creates a dgs combo box, fills it with the names of the connected players and prints the number of items (players) in the chatbox.

DGS = exports.dgs
local playerList = DGS:dgsCreateComboBox(0.35,0.40,0.31,0.20,"Players",true) -- create dgs combo box
for k,player in ipairs(getElementsByType("player")) do -- get the connected players
	DGS:dgsComboBoxAddItem(playerList, getPlayerName(player)) -- add players name to the combo box
end
local playersCount = DGS:dgsComboBoxGetItemCount(playerList) -- get the number of items 
outputChatBox("Number of connected players: "..playersCount) -- show info on chatbox

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