Garry's Mod Wiki

DHorizontalDivider

Description

Creates an invisible vertical divider between two GUI elements.

View source

Parent

Derives methods, etc not listed on this page from DPanel.

Methods

number DHorizontalDivider:GetDividerWidth()
Returns the width of the horizontal divider bar, set by DHorizontalDivider:SetDividerWidth.
boolean DHorizontalDivider:GetDragging()
Returns whether or not the player is currently dragging the middle divider bar.
number DHorizontalDivider:GetHoldPos()
This is used internally - although you're able to use it you probably shouldn't. Returns the local X coordinate of where the player started dragging the thing
Panel DHorizontalDivider:GetLeft()
Returns the left side content of the DHorizontalDivider
number DHorizontalDivider:GetLeftMin()
Returns the minimum width of the left side, set by DHorizontalDivider:SetLeftMin.
number DHorizontalDivider:GetLeftWidth()
Returns the current width of the left side, set by DHorizontalDivider:SetLeftWidth or by the user.
Panel DHorizontalDivider:GetMiddle()
Returns the middle content, set by DHorizontalDivider:SetMiddle.
Panel DHorizontalDivider:GetRight()
Returns the right side content
number DHorizontalDivider:GetRightMin()
Returns the minimum width of the right side, set by DHorizontalDivider:SetRightMin.
DHorizontalDivider:SetDividerWidth( number width )
Sets the width of the horizontal divider bar.
DHorizontalDivider:SetDragging( boolean dragonot )
This is used internally - although you're able to use it you probably shouldn't. Sets whether the player is dragging the divider or not
DHorizontalDivider:SetHoldPos( number x )
This is used internally - although you're able to use it you probably shouldn't. Sets the local X coordinate of where the player started dragging the thing
DHorizontalDivider:SetLeft( Panel pnl )
Sets the left side content of the DHorizontalDivider.
DHorizontalDivider:SetLeftMin( number minWidth )
Sets the minimum width of the left side
DHorizontalDivider:SetLeftWidth( number width )
Sets the current/starting width of the left side. The width of the right side is automatically calculated by subtracting this from the total width of the DHorizontalDivider.
DHorizontalDivider:SetMiddle( Panel middle )
Sets the middle content, over the draggable divider bar panel.
DHorizontalDivider:SetRight( Panel pnl )
Sets the right side content
DHorizontalDivider:SetRightMin( number minWidth )
Sets the minimum width of the right side
DHorizontalDivider:StartGrab()
This is used internally - although you're able to use it you probably shouldn't. TODO Document me

Example

Insert a horizontal divider between two DPanels in a DFrame.

local f = vgui.Create( "DFrame" ) f:SetSize( 400, 200 ) f:Center() f:MakePopup() local LeftPanel = vgui.Create( "DPanel", f ) -- Can be any panel, it will be stretched local RightPanel = vgui.Create( "DPanel", f ) local div = vgui.Create( "DHorizontalDivider", f ) div:Dock( FILL ) -- Make the divider fill the space of the DFrame div:SetLeft( LeftPanel ) -- Set what panel is in left side of the divider div:SetRight( RightPanel ) div:SetDividerWidth( 4 ) -- Set the divider width. Default is 8 div:SetLeftMin( 20 ) -- Set the Minimum width of left side div:SetRightMin( 20 ) div:SetLeftWidth( 50 ) -- Set the default left side width