Category:DIconLayout

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(d)
 
Line 1: Line 1:
 
{{Panel
 
{{Panel
|Name=DIconLayout
 
 
|Parent=DDragBase
 
|Parent=DDragBase
 
|Description=DIconLayout is what replaced {{Type|DPanelList}} in Garry's Mod 13. DPanelList still exists in GMod but is deprecated and does not support the new GWEN skin.
 
|Description=DIconLayout is what replaced {{Type|DPanelList}} in Garry's Mod 13. DPanelList still exists in GMod but is deprecated and does not support the new GWEN skin.
Line 7: Line 6:
 
}}
 
}}
 
{{Example
 
{{Example
|Code=
+
|Code=local Frame = vgui.Create( "DFrame" ) -- Create a Frame to contain everything.
local Frame = vgui.Create( "DFrame" ) //Create a Frame to contain everything.
+
 
Frame:SetTitle( "DIconLayout Example" )
 
Frame:SetTitle( "DIconLayout Example" )
Frame:SetSize( 375, 240 )
+
Frame:SetSize( 365, 240 )
 
Frame:Center()
 
Frame:Center()
 
Frame:MakePopup()
 
Frame:MakePopup()
  
local Scroll = vgui.Create( "DScrollPanel", Frame ) //Create the Scroll panel
+
local Scroll = vgui.Create( "DScrollPanel", Frame ) -- Create the Scroll panel
Scroll:SetSize( 355, 200 )
+
Scroll:Dock( FILL )
Scroll:SetPos( 10, 30 )
+
  
local List   = vgui.Create( "DIconLayout", Scroll )
+
local List = vgui.Create( "DIconLayout", Scroll )
List:SetSize( 340, 200 )
+
List:Dock( FILL )
List:SetPos( 0, 0 )
+
List:SetSpaceY( 5 ) -- Sets the space in between the panels on the Y Axis by 5
List:SetSpaceY( 5 ) //Sets the space in between the panels on the Y Axis by 5
+
List:SetSpaceX( 5 ) -- Sets the space in between the panels on the X Axis by 5
List:SetSpaceX( 5 ) //Sets the space in between the panels on the X Axis by 5
+
  
for i = 1, 35 do //Make a loop to create a bunch of panels inside of the DIconLayout
+
for i = 1, 20 do -- Make a loop to create a bunch of panels inside of the DIconLayout
local ListItem = List:Add( "DPanel" ) //Add DPanel to the DIconLayout
+
local ListItem = List:Add( "DPanel" ) -- Add DPanel to the DIconLayout
ListItem:SetSize( 80, 40 ) //Set the size of it
+
ListItem:SetSize( 80, 40 ) -- Set the size of it
//You don't need to set the position, that is done automatically.
+
-- You don't need to set the position, that is done automatically.
 +
end
 +
 
 +
local ListLabel = List:Add( "DLabel" ) -- Add a label that will be the only panel on its row
 +
ListLabel.OwnLine = true -- The magic variable that specifies this item has its own line all for itself
 +
ListLabel:SetText( "Hello World!" )
 +
 
 +
for i = 1, 5 do
 +
local ListItem = List:Add( "DPanel" )
 +
ListItem:SetSize( 80, 40 )
 
end
 
end
 
}}
 
}}

Latest revision as of 07:52, 5 January 2018

Contents

DescriptionPanelPage

DIconLayout is what replaced DPanelList in Garry's Mod 13. DPanelList still exists in GMod but is deprecated and does not support the new GWEN skin.

DIconLayout is used to make a list of panels. Unlike DPanelList, DIconLayout does not automatically add a scroll bar - the example below shows you how you can do this.

Inherited Functions

Inherits the following functions from DDragBase and its parents up to 3 levels deep:


Examples

Example

local Frame = vgui.Create( "DFrame" ) -- Create a Frame to contain everything.
Frame:SetTitle( "DIconLayout Example" )
Frame:SetSize( 365, 240 )
Frame:Center()
Frame:MakePopup()

local Scroll = vgui.Create( "DScrollPanel", Frame ) -- Create the Scroll panel
Scroll:Dock( FILL )

local List = vgui.Create( "DIconLayout", Scroll )
List:Dock( FILL )
List:SetSpaceY( 5 ) -- Sets the space in between the panels on the Y Axis by 5
List:SetSpaceX( 5 ) -- Sets the space in between the panels on the X Axis by 5

for i = 1, 20 do -- Make a loop to create a bunch of panels inside of the DIconLayout
	local ListItem = List:Add( "DPanel" ) -- Add DPanel to the DIconLayout
	ListItem:SetSize( 80, 40 ) -- Set the size of it
	-- You don't need to set the position, that is done automatically.
end

local ListLabel = List:Add( "DLabel" ) -- Add a label that will be the only panel on its row
ListLabel.OwnLine = true -- The magic variable that specifies this item has its own line all for itself
ListLabel:SetText( "Hello World!" )

for i = 1, 5 do
	local ListItem = List:Add( "DPanel" )
	ListItem:SetSize( 80, 40 )
end


Personal tools
Navigation