DgsComboBoxGetItemCount

From Multi Theft Auto: Wiki

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

Multi Language Supports

Animation

3D Interface

3D Text

Arrow List

Browser

Button

Check Box

Combo Box

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