Classe motore
UITableLayout
*Questo contenuto è tradotto usando AI (Beta) e potrebbe contenere errori. Per visualizzare questa pagina in inglese, clicca qui.
Sommario
Proprietà
Membri ereditati
Membri ereditati da UIGridStyleLayout: 7
Membri ereditati da Instance: 57
Membri ereditati da Object: 6
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
endRiferimento API
Proprietà
FillEmptySpaceColumns
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
endFillEmptySpaceRows
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
endMajorAxis
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
endPadding
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