local function DoDrop( self, panels, bDoDrop, Command, x, y )
if ( bDoDrop )
then
for _, v
in ipairs( panels )
do
self:
AddItem( v )
end
end
end
concommand.
Add(
"test2",
function()
local frame
= vgui.
Create(
"DFrame" )
frame:
SetSize(
500,
300 )
frame:
SetTitle(
"Frame" )
frame:
MakePopup()
frame:
Center()
local left
= vgui.
Create(
"DScrollPanel", frame )
left:
Dock( LEFT )
left:
SetWidth(
frame:
GetWide()
/ 2 - 7 )
left:
SetPaintBackground(
true )
left:
DockMargin(
0,
0,
4,
0 )
left:
Receiver(
"myDNDname", DoDrop )
local right
= vgui.
Create(
"DScrollPanel", frame )
right:
Dock( FILL )
right:
SetPaintBackground(
true )
right:
Receiver(
"myDNDname", DoDrop )
for i
= 1,
30 do
local but
= vgui.
Create(
"DButton" )
but:
SetText(
"button text " .. i )
but:
SetSize(
36,
24 )
but:
Dock( TOP )
but:
Droppable(
"myDNDname" )
right:
AddItem( but )
local mdl
= vgui.
Create(
"DModelPanel", but )
mdl:
Dock( FILL )
mdl:
SetModel(
"models/alyx.mdl" )
mdl:
SetDragParent( but )
end
end )