Impara
Classe motore
UITableLayout

*Questo contenuto è tradotto usando AI (Beta) e potrebbe contenere errori. Per visualizzare questa pagina in inglese, clicca qui.


Sommario
Membri ereditati
Campioni di codice
Costruisci Tabella UI
local frame = script.Parent
-- Dati della tabella
local headerWidth = { 200, 80, 80 }
local headers = {
"Nome",
"Lavoro",
"Denaro",
}
local data = {
{ "Bob", "Cameriere", 100 },
{ "Lisa", "Poliziotto", 200 },
{ "George", "-", 50 },
}
-- Prima, costruisci il layout della tabella
local uiTableLayout = Instance.new("UITableLayout")
uiTableLayout.FillDirection = Enum.FillDirection.Vertical
uiTableLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
uiTableLayout.VerticalAlignment = Enum.VerticalAlignment.Center
uiTableLayout.FillEmptySpaceColumns = false
uiTableLayout.FillEmptySpaceRows = false
uiTableLayout.Padding = UDim2.new(0, 5, 0, 5)
uiTableLayout.SortOrder = Enum.SortOrder.LayoutOrder
frame.Size = UDim2.new(0, 0, 0, 40) -- La dimensione del frame genitore è la dimensione della cella
uiTableLayout.Parent = frame
-- Successivamente, crea le intestazioni delle colonne
local headerFrame = Instance.new("Frame")
headerFrame.Name = "Intestazioni"
headerFrame.Parent = frame
for i = 1, #headers do
local headerText = headers[i]
local headerCell = Instance.new("TextLabel")
headerCell.Text = headerText
headerCell.Name = headerText
headerCell.LayoutOrder = i
headerCell.Size = UDim2.new(0, 0, 0, 24)
headerCell.Parent = headerFrame
local headerSize = Instance.new("UISizeConstraint")
headerSize.MinSize = Vector2.new(headerWidth[i], 0)
headerSize.Parent = headerCell
end
-- Infine, aggiungi righe di dati iterando su ciascuna riga e le colonne in quella riga
for index, value in ipairs(data) do
local rowData = value
local rowFrame = Instance.new("Frame")
rowFrame.Name = "Riga" .. index
rowFrame.Parent = frame
for col = 1, #value do
local cellData = rowData[col]
local cell = Instance.new("TextLabel")
cell.Text = cellData
cell.Name = headers[col]
cell.TextXAlignment = Enum.TextXAlignment.Left
if tonumber(cellData) then -- Se questa cella è un numero, allineala a destra invece
cell.TextXAlignment = Enum.TextXAlignment.Right
end
cell.ClipsDescendants = true
cell.Size = UDim2.new(0, 0, 0, 24)
cell.Parent = rowFrame
end
end

Riferimento API
Proprietà
FillEmptySpaceColumns
Lettura Parallela
Capacità: UI
UITableLayout.FillEmptySpaceColumns:boolean
Campioni di codice
Costruisci Tabella UI
local frame = script.Parent
-- Dati della tabella
local headerWidth = { 200, 80, 80 }
local headers = {
"Nome",
"Lavoro",
"Denaro",
}
local data = {
{ "Bob", "Cameriere", 100 },
{ "Lisa", "Poliziotto", 200 },
{ "George", "-", 50 },
}
-- Prima, costruisci il layout della tabella
local uiTableLayout = Instance.new("UITableLayout")
uiTableLayout.FillDirection = Enum.FillDirection.Vertical
uiTableLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
uiTableLayout.VerticalAlignment = Enum.VerticalAlignment.Center
uiTableLayout.FillEmptySpaceColumns = false
uiTableLayout.FillEmptySpaceRows = false
uiTableLayout.Padding = UDim2.new(0, 5, 0, 5)
uiTableLayout.SortOrder = Enum.SortOrder.LayoutOrder
frame.Size = UDim2.new(0, 0, 0, 40) -- La dimensione del frame genitore è la dimensione della cella
uiTableLayout.Parent = frame
-- Successivamente, crea le intestazioni delle colonne
local headerFrame = Instance.new("Frame")
headerFrame.Name = "Intestazioni"
headerFrame.Parent = frame
for i = 1, #headers do
local headerText = headers[i]
local headerCell = Instance.new("TextLabel")
headerCell.Text = headerText
headerCell.Name = headerText
headerCell.LayoutOrder = i
headerCell.Size = UDim2.new(0, 0, 0, 24)
headerCell.Parent = headerFrame
local headerSize = Instance.new("UISizeConstraint")
headerSize.MinSize = Vector2.new(headerWidth[i], 0)
headerSize.Parent = headerCell
end
-- Infine, aggiungi righe di dati iterando su ciascuna riga e le colonne in quella riga
for index, value in ipairs(data) do
local rowData = value
local rowFrame = Instance.new("Frame")
rowFrame.Name = "Riga" .. index
rowFrame.Parent = frame
for col = 1, #value do
local cellData = rowData[col]
local cell = Instance.new("TextLabel")
cell.Text = cellData
cell.Name = headers[col]
cell.TextXAlignment = Enum.TextXAlignment.Left
if tonumber(cellData) then -- Se questa cella è un numero, allineala a destra invece
cell.TextXAlignment = Enum.TextXAlignment.Right
end
cell.ClipsDescendants = true
cell.Size = UDim2.new(0, 0, 0, 24)
cell.Parent = rowFrame
end
end

FillEmptySpaceRows
Lettura Parallela
Capacità: UI
UITableLayout.FillEmptySpaceRows:boolean
Campioni di codice
Costruisci Tabella UI
local frame = script.Parent
-- Dati della tabella
local headerWidth = { 200, 80, 80 }
local headers = {
"Nome",
"Lavoro",
"Denaro",
}
local data = {
{ "Bob", "Cameriere", 100 },
{ "Lisa", "Poliziotto", 200 },
{ "George", "-", 50 },
}
-- Prima, costruisci il layout della tabella
local uiTableLayout = Instance.new("UITableLayout")
uiTableLayout.FillDirection = Enum.FillDirection.Vertical
uiTableLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
uiTableLayout.VerticalAlignment = Enum.VerticalAlignment.Center
uiTableLayout.FillEmptySpaceColumns = false
uiTableLayout.FillEmptySpaceRows = false
uiTableLayout.Padding = UDim2.new(0, 5, 0, 5)
uiTableLayout.SortOrder = Enum.SortOrder.LayoutOrder
frame.Size = UDim2.new(0, 0, 0, 40) -- La dimensione del frame genitore è la dimensione della cella
uiTableLayout.Parent = frame
-- Successivamente, crea le intestazioni delle colonne
local headerFrame = Instance.new("Frame")
headerFrame.Name = "Intestazioni"
headerFrame.Parent = frame
for i = 1, #headers do
local headerText = headers[i]
local headerCell = Instance.new("TextLabel")
headerCell.Text = headerText
headerCell.Name = headerText
headerCell.LayoutOrder = i
headerCell.Size = UDim2.new(0, 0, 0, 24)
headerCell.Parent = headerFrame
local headerSize = Instance.new("UISizeConstraint")
headerSize.MinSize = Vector2.new(headerWidth[i], 0)
headerSize.Parent = headerCell
end
-- Infine, aggiungi righe di dati iterando su ciascuna riga e le colonne in quella riga
for index, value in ipairs(data) do
local rowData = value
local rowFrame = Instance.new("Frame")
rowFrame.Name = "Riga" .. index
rowFrame.Parent = frame
for col = 1, #value do
local cellData = rowData[col]
local cell = Instance.new("TextLabel")
cell.Text = cellData
cell.Name = headers[col]
cell.TextXAlignment = Enum.TextXAlignment.Left
if tonumber(cellData) then -- Se questa cella è un numero, allineala a destra invece
cell.TextXAlignment = Enum.TextXAlignment.Right
end
cell.ClipsDescendants = true
cell.Size = UDim2.new(0, 0, 0, 24)
cell.Parent = rowFrame
end
end

MajorAxis
Lettura Parallela
Capacità: UI
UITableLayout.MajorAxis:Enum.TableMajorAxis
Campioni di codice
Costruisci Tabella UI
local frame = script.Parent
-- Dati della tabella
local headerWidth = { 200, 80, 80 }
local headers = {
"Nome",
"Lavoro",
"Denaro",
}
local data = {
{ "Bob", "Cameriere", 100 },
{ "Lisa", "Poliziotto", 200 },
{ "George", "-", 50 },
}
-- Prima, costruisci il layout della tabella
local uiTableLayout = Instance.new("UITableLayout")
uiTableLayout.FillDirection = Enum.FillDirection.Vertical
uiTableLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
uiTableLayout.VerticalAlignment = Enum.VerticalAlignment.Center
uiTableLayout.FillEmptySpaceColumns = false
uiTableLayout.FillEmptySpaceRows = false
uiTableLayout.Padding = UDim2.new(0, 5, 0, 5)
uiTableLayout.SortOrder = Enum.SortOrder.LayoutOrder
frame.Size = UDim2.new(0, 0, 0, 40) -- La dimensione del frame genitore è la dimensione della cella
uiTableLayout.Parent = frame
-- Successivamente, crea le intestazioni delle colonne
local headerFrame = Instance.new("Frame")
headerFrame.Name = "Intestazioni"
headerFrame.Parent = frame
for i = 1, #headers do
local headerText = headers[i]
local headerCell = Instance.new("TextLabel")
headerCell.Text = headerText
headerCell.Name = headerText
headerCell.LayoutOrder = i
headerCell.Size = UDim2.new(0, 0, 0, 24)
headerCell.Parent = headerFrame
local headerSize = Instance.new("UISizeConstraint")
headerSize.MinSize = Vector2.new(headerWidth[i], 0)
headerSize.Parent = headerCell
end
-- Infine, aggiungi righe di dati iterando su ciascuna riga e le colonne in quella riga
for index, value in ipairs(data) do
local rowData = value
local rowFrame = Instance.new("Frame")
rowFrame.Name = "Riga" .. index
rowFrame.Parent = frame
for col = 1, #value do
local cellData = rowData[col]
local cell = Instance.new("TextLabel")
cell.Text = cellData
cell.Name = headers[col]
cell.TextXAlignment = Enum.TextXAlignment.Left
if tonumber(cellData) then -- Se questa cella è un numero, allineala a destra invece
cell.TextXAlignment = Enum.TextXAlignment.Right
end
cell.ClipsDescendants = true
cell.Size = UDim2.new(0, 0, 0, 24)
cell.Parent = rowFrame
end
end

Padding
Lettura Parallela
Capacità: UI
UITableLayout.Padding:UDim2
Campioni di codice
Costruisci Tabella UI
local frame = script.Parent
-- Dati della tabella
local headerWidth = { 200, 80, 80 }
local headers = {
"Nome",
"Lavoro",
"Denaro",
}
local data = {
{ "Bob", "Cameriere", 100 },
{ "Lisa", "Poliziotto", 200 },
{ "George", "-", 50 },
}
-- Prima, costruisci il layout della tabella
local uiTableLayout = Instance.new("UITableLayout")
uiTableLayout.FillDirection = Enum.FillDirection.Vertical
uiTableLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
uiTableLayout.VerticalAlignment = Enum.VerticalAlignment.Center
uiTableLayout.FillEmptySpaceColumns = false
uiTableLayout.FillEmptySpaceRows = false
uiTableLayout.Padding = UDim2.new(0, 5, 0, 5)
uiTableLayout.SortOrder = Enum.SortOrder.LayoutOrder
frame.Size = UDim2.new(0, 0, 0, 40) -- La dimensione del frame genitore è la dimensione della cella
uiTableLayout.Parent = frame
-- Successivamente, crea le intestazioni delle colonne
local headerFrame = Instance.new("Frame")
headerFrame.Name = "Intestazioni"
headerFrame.Parent = frame
for i = 1, #headers do
local headerText = headers[i]
local headerCell = Instance.new("TextLabel")
headerCell.Text = headerText
headerCell.Name = headerText
headerCell.LayoutOrder = i
headerCell.Size = UDim2.new(0, 0, 0, 24)
headerCell.Parent = headerFrame
local headerSize = Instance.new("UISizeConstraint")
headerSize.MinSize = Vector2.new(headerWidth[i], 0)
headerSize.Parent = headerCell
end
-- Infine, aggiungi righe di dati iterando su ciascuna riga e le colonne in quella riga
for index, value in ipairs(data) do
local rowData = value
local rowFrame = Instance.new("Frame")
rowFrame.Name = "Riga" .. index
rowFrame.Parent = frame
for col = 1, #value do
local cellData = rowData[col]
local cell = Instance.new("TextLabel")
cell.Text = cellData
cell.Name = headers[col]
cell.TextXAlignment = Enum.TextXAlignment.Left
if tonumber(cellData) then -- Se questa cella è un numero, allineala a destra invece
cell.TextXAlignment = Enum.TextXAlignment.Right
end
cell.ClipsDescendants = true
cell.Size = UDim2.new(0, 0, 0, 24)
cell.Parent = rowFrame
end
end

© 2026 Roblox Corporation. Roblox, il logo Roblox e Powering Imagination sono tra i nostri marchi registrati e non registrati negli Stati Uniti. e altri paesi.