DgsComboBoxGetItemCount

From Multi Theft Auto: Wiki
Revision as of 07:42, 29 January 2019 by Thisdp (talk | contribs) (Created page with "{{Client function}} ==Syntax== <syntaxhighlight lang="lua"> int dgsComboBoxGetItemCount ( element comboBox ) </syntaxhighlight> ===Required Arguments=== *'''comboBox:'''...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

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

General

Check Box

Combo Box

Drag'N Drop

Edit

Grid List

Menu

Selector

Mouse

Radio Button

Switch Button

Tab

Animation

Plugin

Media

Color Picker

QRCode

Remote Image