Similarly to DIconLayout, this lays out panels in two dimensions as tiles. The difference between this and DIconLayout is that DIconLayout items all have the same height while DTileLayout items do not have this enforcement. DTileLayout will find the best way to "pack" its chidren. For example, in a two column layout, a item of height 2 units will be placed in one column while two items of height 1 unit will be placed in the other column. It is worth noting however that because this panel iterates through its children in an undefined order and lays out while it is iterating, there is no guarentee that this packing will lead to the lowest possible height.
This is used by the spawnmenu to arrange spawnicons.
The base size defines the smallest a tile can be, and it will resize vertically to accommodate all child panels. The number of elements in each row is determinded by the base size and width.
It also optionally permits the rearrangement of these tiles. To enable this functionality, call DDragBase:MakeDroppable on the DTileLayout with a unique identifier. All panels added following this will be moveable.
Inherits the following functions from DDragBase and its parents up to 3 levels deep:
local frame = vgui.Create("DFrame") frame:SetSize(300, 300) frame:SetTitle("DTileLayout Example") frame:MakePopup() frame:Center() local layout = vgui.Create("DTileLayout", frame) layout:SetBaseSize(32) -- Tile size layout:Dock(FILL) //Draw a background so we can see what it's doing layout:SetDrawBackground(true) layout:SetBackgroundColor(Color(0, 100, 100)) layout:MakeDroppable("unique_name") -- Allows us to rearrange children for i = 1, 32 do layout:Add(Label(" Label " .. i)) end
Pages in category "DTileLayout"
The following 21 pages are in this category, out of 21 total.