DgsComboBoxSetItemImage

From Multi Theft Auto: Wiki
Revision as of 10:40, 5 August 2023 by Thisdp (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function sets the image on a combo box item.

Syntax

bool dgsComboBoxSetItemImage( element comboBox, int itemIndex, element texture [, int color = 0xFFFFFFFF, float offsetX = 0, float offsetY = 0, float width, float height, bool relative ] )

Required Arguments

  • comboBox: the combo box containing the item you're interested in.
  • itemIndex: An integer of the index of the item.
  • texture: A texture element of the item you want to set.

Optional Arguments

  • color: An integer of the color of the texture.
  • offsetX : A float of the 2D X offset of the image of the item.
  • offsetY : A float of the 2D Y offset of the image of the item.
  • width: A float of the width of the image of the item.
  • height: A float of the height of the image of the item.
  • relative: This is whether sizes and positioning are relative. If this is true, then all offestX, offestY, width and height floats must be between 0 and 1, representing sizes relative to the item.

Returns

Returns true if set successfully, false if one of the arguments was invalid.

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

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