Garry's Mod Wiki

Revision Difference

DDragBase#529051

<panel> <parent>DPanel</parent> <description> <internal></internal> A VGUI base panel providing drag/drop functionality. Used by <page>DIconLayout</page>, <page>DListLayout</page> and <page>DTileLayout</page>. </description> </panel> <example> <code> 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: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 </code> </example>