Jump to content

Switch column in GUI


ds1-e

Recommended Posts

  • Scripting Moderators

Hey. How can i switch to other column after adding rows? After adding teams, it adds player names, but i want player names be under "Name" column, not in "Team" column.

local scoreBoardGridList = guiCreateGridList(0, 0.0450, 1.30, 0.98, true, scoreBoard)
local scoreBoardColumn = {}

scoreBoardColumn[1] = guiGridListAddColumn(scoreBoardGridList, "Team", 0.16)

local teams = getElementsByType("team")
for k, v in pairs(teams) do
	local r, g, b = getTeamColor(v)
	local row = guiGridListAddRow(scoreBoardGridList, getTeamName(v))
	guiGridListSetItemColor(scoreBoardGridList, row, scoreBoardColumn[1], r, g, b)
end

scoreBoardColumn[2] = guiGridListAddColumn(scoreBoardGridList, "Name", 0.16)

local players = getElementsByType("player")
for k, v in pairs(players) do
	local row = guiGridListAddRow(scoreBoardGridList, getPlayerName(v))
end

 

Link to comment
  • Moderators
guiGridListAddRow(scoreBoardGridList, getTeamName(team), getPlayerName(v))

 

It is not very flexible, but you should consider each row an item with mutiple properties.

If the two columns aren't related, then you need two gridlists.

 

@majqq

Edited by IIYAMA
  • Like 1
Link to comment
  • Scripting Moderators
6 hours ago, IIYAMA said:

guiGridListAddRow(scoreBoardGridList, getTeamName(team), getPlayerName(v))

 

It is not very flexible, but you should consider each row an item with mutiple properties.

If the two columns aren't related, then you need two gridlists.

 

@majqq

Is there anyway to hide scrollbar which creates automatically?

fpE7qb9.png

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...