Properties
UDim
|
Determines the amount of free space between each element. |
Inherited from UIGridStyleLayout: Show
Vector2
[ReadOnly]
[NotReplicated]
|
The absolute size of space being taken up by the grid layout. |
FillDirection
|
Determines the axis in which UI elements are laid out. |
HorizontalAlignment
|
Determines the horizontal alignment of UI elements within the parent element. |
SortOrder
|
Determines the manner in which the next UI element is chosen when being laid out. |
VerticalAlignment
|
Determines the vertical alignment of UI elements within the parent element. |
bool
|
Determines if an |
string
[ReadOnly]
[NotReplicated]
|
A read-only string representing the class this |
int
[ReadOnly]
[NotReplicated]
[Deprecated]
|
The cost of saving the instance using data persistence. |
string
|
A non-unique identifier of the |
Instance
[NotReplicated]
|
Determines the hierarchical parent of the |
bool
|
A deprecated property that used to protect |
bool
[Hidden]
[NotReplicated]
[Deprecated]
|
string
[ReadOnly]
[NotReplicated]
[Deprecated]
|
Functions
void
|
This function destroys all of an |
Instance
|
Create a copy of an object and all its descendants, ignoring objects that are not |
void
|
Sets the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first child of the |
Instance
|
Returns the first child of the |
Instance
|
Returns the first child of the |
Instance
|
Variant
|
Returns the attribute which has been assigned to the given name |
RBXScriptSignal
|
Returns an event that fires when the given attribute changes |
Dictionary
|
Returns a dictionary of string → variant pairs for each of the |
Objects
|
Returns an array containing all of the |
string
[NotBrowsable]
|
Returns a coded string of the |
Array
[CustomLuaState]
|
Returns an array containing all of the descendants of the instance |
string
|
Returns a string describing the |
RBXScriptSignal
|
Get an event that fires when a given property of an object changes. |
bool
[CustomLuaState]
|
Returns true if an |
bool
|
Returns true if an |
bool
|
Returns true if an |
void
[Deprecated]
|
Sets the object’s Parent to nil, and does the same for all its descendants. |
void
|
Sets the attribute with the given name to the given value |
Instance
[CustomLuaState]
[CanYield]
|
Returns the child of the |
Objects
[Deprecated]
|
Returns an array of the object’s children. |
Instance
[Deprecated]
|
void
[Deprecated]
|
Instance
[Deprecated]
|
Objects
[Deprecated]
|
bool
[Deprecated]
[CustomLuaState]
|
bool
[Deprecated]
|
void
[Deprecated]
|
Events
RBXScriptSignal
|
Fires when the |
RBXScriptSignal
|
Fires whenever an attribute is changed on the |
RBXScriptSignal
|
Fired immediately after a property of an object changes. |
RBXScriptSignal
|
Fires when an object is parented to this |
RBXScriptSignal
|
Fires when a child is removed from this |
RBXScriptSignal
|
Fires when a descendant is added to the |
RBXScriptSignal
|
Fires immediately before a descendant of the |
RBXScriptSignal
[Deprecated]
|
Code Samples
UI Sort Order
This code sample demonstrates sorting data using UIGridStyleLayout/SortOrder
and GuiObject/LayoutOrder
.
-- Place in a script in a UIListLayout
local uiGridLayout = script.Parent
-- Some data to work with
local scores = {
["Player1"] = 2048;
["Ozzypig"] = 1337;
["Shedletsky"] = 1250;
["Builderman"] = 1000;
}
-- Build a scoreboard
for name, score in pairs(scores) do
local tl = Instance.new("TextLabel")
tl.Text = name .. ": " .. score
tl.Parent = script.Parent
tl.LayoutOrder = -score -- We want higher scores first, so negate for descending order
tl.Name = name
tl.Size = UDim2.new(0, 200, 0, 50)
tl.Parent = uiGridLayout.Parent
end
while true do
-- The name is the player's name
uiGridLayout.SortOrder = Enum.SortOrder.Name
uiGridLayout:ApplyLayout()
wait(2)
-- Since we set the LayoutOrder to the score, this will sort by descending score!
uiGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
uiGridLayout:ApplyLayout()
wait(2)
end
Show All Fonts
This code sample renders a list of all the available fonts.
local frame = script.Parent
-- Create a TextLabel displaying each font
for i, font in pairs(Enum.Font:GetEnumItems()) do
local tl = Instance.new("TextLabel")
tl.Name = font.Name
-- Set the text properties
tl.Text = font.Name
tl.Font = font
-- Some rendering properties
tl.TextSize = 24
tl.TextXAlignment = Enum.TextXAlignment.Left
-- Size the frame equal to the height of the text
tl.Size = UDim2.new(1, 0, 0, tl.TextSize)
-- Add to the parent frame
tl.Parent = frame
end
-- Layout the frames in a list (if they aren't already)
if not frame:FindFirstChildOfClass("UIListLayout") then
Instance.new("UIListLayout", frame)
end
UI Scale Demo
This code sample creates some images of a lock and scales them using UIScale. It lays them out suing a UIListLayout.
-- Lay out the images in a list
Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
-- Create some images of varying sizes using UIScale objects
for size = .2, 1.5, .2 do
local image = Instance.new("ImageLabel")
image.Image = "rbxassetid://284402752" -- an image of a Lock
image.Parent = script.Parent
image.Size = UDim2.new(0, 100, 0, 100)
-- Scale the image by adding a UIScale with the size
-- Note: this is a shorthand since we don't need a reference to the UIScale
Instance.new("UIScale", image).Scale = size
end