DgsComboBoxGetItemImage: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} This function gets the image from a combo box item. ==Syntax== <syntaxhighlight lang="lua"> texture, int, float, float, float, float dgsComboBoxGetItemImage( element comboBox, int itemIndex ) </syntaxhighlight> ===Required Arguments=== *'''comboBox:''' the combo box containing the item you're interested in. *'''itemIndex:''' An integer of the index of the item. ===Returns=== Returns texture, Color, PosX, PosY, Width, Height if success , ''false'...")
 
 
Line 23: Line 23:
DGS:dgsSetProperty(combobox,"itemHeight",30) -- make it thicker to see the image clearer
DGS:dgsSetProperty(combobox,"itemHeight",30) -- make it thicker to see the image clearer
for i=1,10 do
for i=1,10 do
local row = DGS:dgsComboBoxAddItem(combobox)
local item = DGS:dgsComboBoxAddItem(combobox)
DGS:dgsComboBoxSetItemImage(combobox,row,texture,tocolor(255,255,255,255),10,5,25,20,false)
DGS:dgsComboBoxSetItemImage(combobox,item,texture,tocolor(255,255,255,255),10,5,25,20,false)
end
end



Latest revision as of 10:40, 5 August 2023

This function gets the image from a combo box item.

Syntax

texture, int, float, float, float, float dgsComboBoxGetItemImage( element comboBox, int itemIndex )

Required Arguments

  • comboBox: the combo box containing the item you're interested in.
  • itemIndex: An integer of the index of the item.

Returns

Returns texture, Color, PosX, PosY, Width, Height if success , false otherwise.

Example

DGS = exports.dgs
texture = dxCreateTexture("image.png") -- put your texture element here

combobox = DGS:dgsCreateComboBox(300,200,300,400,"Select an item",false)
DGS:dgsSetProperty(combobox,"itemHeight",30) -- make it thicker to see the image clearer
for i=1,10 do
	local item = DGS:dgsComboBoxAddItem(combobox)
	DGS:dgsComboBoxSetItemImage(combobox,item,texture,tocolor(255,255,255,255),10,5,25,20,false)
end

Image, Color, PosX, PosY, Width, Height = DGS:dgsComboBoxGetItemImage(combobox,2,1)
outputChatBox("Color:"..Color)

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