DgsGridListSetSelectedItems: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} __NOTOC__ This function selects multipile items in the specific dgs grid list. ==Syntax== <syntaxhighlight lang="lua"> bool dgsGridListSetSelectedItems (...")
 
 
(3 intermediate revisions by the same user not shown)
Line 14: Line 14:
table = {
table = {
     [1] = {
     [1] = {
         ["column"], -- has the first selected item's column ID
         ["column"] = columnID, -- has the first selected item's column ID
         ["row"] -- has the first selected item's row ID
         ["row"] = rowID        -- has the first selected item's row ID
     },
     },
     [2] = {
     [2] = {
         ["column"],-- has the second selected item's column ID
         ["column"] = columnID, -- has the second selected item's column ID
         ["row"] -- has the second selected item's row ID
         ["row"] = rowID        -- has the second selected item's row ID
     },
     },
     ...
     ...
Line 31: Line 31:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
DGS = exports.dgs
DGS = exports.dgs
-- This example creates a grid list of all players, clicking "Selected" button will then use dgsGridListGetSelectedItems to show all selected items.
-- This example creates a grid list of all players and select an item at row 1 column 1.
playerWindow = DGS:dgsCreateWindow(526, 230, 291, 284, "", false)
playerWindow = DGS:dgsCreateWindow(526, 230, 291, 284, "", false)
gridlistPlayers = DGS:dgsCreateGridList(9, 23, 272, 201, false, playerWindow)
gridlistPlayers = DGS:dgsCreateGridList(9, 23, 272, 201, false, playerWindow)
Line 50: Line 50:
==See Also==
==See Also==
{{DGSFUNCTIONS}}
{{DGSFUNCTIONS}}
{{DGSEVENTS}}

Latest revision as of 07:54, 30 June 2024

This function selects multipile items in the specific dgs grid list.

Syntax

bool dgsGridListSetSelectedItems ( element gridList , table items )

Required Arguments

  • gridList: The dgs grid list which you want to select items in.
  • items: The item table in this format ( the same as cegui's ) :
table = {
    [1] = {
        ["column"] = columnID,  -- has the first selected item's column ID
        ["row"] = rowID         -- has the first selected item's row ID
    },
    [2] = {
        ["column"] = columnID,  -- has the second selected item's column ID
        ["row"] = rowID         -- has the second selected item's row ID
    },
    ...
}

Returns

Returns true if successful, false otherwise.

Example

DGS = exports.dgs
-- This example creates a grid list of all players and select an item at row 1 column 1.
playerWindow = DGS:dgsCreateWindow(526, 230, 291, 284, "", false)
gridlistPlayers = DGS:dgsCreateGridList(9, 23, 272, 201, false, playerWindow)
DGS:dgsGridListAddColumn(gridlistPlayers, "Players", 0.9)
DGS:dgsGridListSetSelectionMode(gridlistPlayers, 1) -- So can select many players
for _, players in ipairs(getElementsByType("player")) do 
	local row = DGS:dgsGridListAddRow(gridlistPlayers)
	DGS:dgsGridListSetItemText(gridlistPlayers, row, 1, getPlayerName(players))
end 
DGS:dgsGridListSetSelectedItems(gridlistPlayers,{
	{
		row = 1,
		column = 1
	},
})

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