DgsGridListSetItemImage

From Multi Theft Auto: Wiki

This function sets the image on a grid list item.

Syntax

bool dgsGridListSetItemImage( element gridList, int rowIndex, int columnIndex, element texture [, int color = 0xFFFFFFFF, float offsetX = 0, float offsetY = 0, float width, float height ] )
Item Image

Required Arguments

  • gridList: the grid list containing the item you're interested in.
  • rowIndex: An integer of the row index of the item.
  • columnIndex: An integer of the column 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.

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

gridlist = DGS:dgsCreateGridList(300,200,300,400,false)
DGS:dgsSetProperty(gridlist,"rowHeight",30) -- make it thicker to see the image clearer
DGS:dgsGridListAddColumn(gridlist,"Country",0.2)
DGS:dgsGridListAddColumn(gridlist,"ID",0.7)
for i=1,10 do
	local row = DGS:dgsGridListAddRow(gridlist)
	DGS:dgsGridListSetItemText(gridlist,row,2,tostring(i))
	DGS:dgsGridListSetItemImage(gridlist,row,1,texture,tocolor(255,255,255,255),10,5,25,20)
end

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