DDragBase
Description
This is used internally - although you're able to use it you probably shouldn't.
A VGUI base panel providing drag/drop functionality. Used by DIconLayout, DListLayout and DTileLayout.
Parent
Derives methods, etc not listed on this page from DPanel.
Methods
DDragBase:DropAction_Copy( table drops, boolean bDoDrop, string command, number y, number x )
This is used internally - although you're able to use it you probably shouldn't.
Internal function used in DDragBase:MakeDroppable
DDragBase:DropAction_Normal( table drops, boolean bDoDrop, string command, number y, number x )
This is used internally - although you're able to use it you probably shouldn't.
Internal function used in DDragBase:DropAction_Copy
DDragBase:DropAction_Simple( table drops, boolean bDoDrop, string command, number y, number x )
This is used internally - although you're able to use it you probably shouldn't.
Internal function used in DDragBase:DropAction_Normal
DDragBase:MakeDroppable( string name, boolean allowCopy )
Makes the panel a receiver for any droppable panel with the same DnD name. Internally calls Panel:Receiver.
DDragBase:OnModified()
Called when anything is dropped on or rearranged within the DDragBase.
DDragBase:SetDropPos( string pos = "5" )
Determines where you can drop stuff.
"4" for left
"5" for center
"6" for right
"8" for top
"2" for bottom
DDragBase:UpdateDropTarget( number drop, Panel pnl )
This is used internally - although you're able to use it you probably shouldn't.
Internal function used in DDragBase:DropAction_Normal
Example
local frame = vgui.Create( "DFrame" )
frame:SetSize( 300, 500 )
frame:Center()
frame:MakePopup()
local dragbase = vgui.Create( "DDragBase", frame )
dragbase:Dock( FILL )
dragbase:MakeDroppable( "test" )
dragbase:SetDropPos( "82" )
for i = 0, 10 do
local butt = dragbase:Add( "DButton" )
--butt:Dock( TOP )
butt:SetPos( 25, i * 25 )
butt:SetWidth( 100 )
butt:Droppable( "test" )
butt.id = i
butt.Think = function( s ) s:SetText( "ID: " .. i .. " ZPOS: " .. s:GetZPos() ) end
end