local myForm = VCL.Form("MyForm") local myForm2 = VCL.Form("MyForm2") myForm._ = { caption="Dock and Drop Form", left=300, top=300, width=400, height=400, docksite=true, usedockmanager=true, ondockover="OnDockOver", ondockdrop="OnDockDrop", onundock="OnUnDock", onfiledrop="OnFileDrop", onclose="OnClose", } local lbl = VCL.Label(myForm,"myLabel") lbl.caption = "Drop here some files, or the dockable form..." myForm2._ = { caption="Dockable Form", left=200, top=200, width=200, height=200, borderstyle="bsToolWindow", dragkind="dkDock", dragmode="dmAutomatic", onenddock="OnEndDock", } local lbl2 = VCL.Label(myForm2,"myLabel2") lbl2.caption = "Drop me on the dockform..." function OnDockOver(Sender, Source, X, Y, State) print("OnDockOver", Sender.Name, Source.Name, X, Y, State) -- accept source? return true end function OnDockDrop(Sender, Source, X, Y) print("OnDockDrop", Sender.Name, Source.Name, X, Y) end function OnEndDock(Sender, Target, X, Y) print("OnEndDock", Sender.Name, Target.Name, X, Y) lbl2.caption = "i am a happy form now, doubleclick on my header please!" end function OnUnDock(Sender, Client, NewTarget) print("OnUnDock", Sender.Name, Client.Name) lbl2.caption = "Drop me on the dockform..." -- allow undock? return true end function OnClose(Sender, CanClose) myForm2:Free() myForm:Free() myForm = nil myForm2 = nil print("Forms killed") -- dont continue close process return false end function OnFileDrop(Sender, n,filelist) print("File(s) droppped on "..Sender.name) table.foreach(filelist, function(k,v) print(k, v) end) end; myForm:Show() myForm2:Show()