Arrastrar y soltar
Publicado: 15 Abr 2013 10:24
Se puede arrastrar y soltar en AMS o alguna dll que lo haga, esto digamos como para un reproductor de udio o video...
Foro Especializado en Autoplay Media Studio y más...
http://amsspecialist.com/
if not WinAPI then WinAPI = {}; end
WinAPI.DragAcceptFiles = function (hWnd, bAccept)
assert((type(hWnd) == 'number'), 'Ïåðâûé ïàðàìåòð äîëæåí èìåòü òèï: number')
if bAccept == nil then bAccept = true; end
assert((type(bAccept) == 'boolean'), 'Âòîðîé ïàðàìåòð äîëæåí èìåòü òèï: boolean')
if bAccept == true then bAccept = 1; else bAccept = 0; end
DLL.CallFunction("shell32.dll", "DragAcceptFiles", hWnd..","..bAccept, 1, 1);
end
WinAPI.DragQueryFileEx = function (hDrop, nFlag)
assert((type(hDrop) == 'number'), 'Ïåðâûé ïàðàìåòð äîëæåí èìåòü òèï: number')
nFlag = nFlag or 0;
assert((type(nFlag) == 'number'), 'Âòîðîé ïàðàìåòð äîëæåí èìåòü òèï: number')
local Ret, nCount, bDir, sFile, pData
local tData = {};
Ret = DLL.CallFunction("shell32.dll", "DragQueryFileA", hDrop..",-1,0,0", 0, 1);
if Ret == "0" then return false; end
nCount = tonumber(Ret);
for i = 0, nCount - 1 do
pData = Memory.Allocate(1024);
Ret = DLL.CallFunction("shell32.dll", "DragQueryFileA", hDrop..","..i..","..pData..",1024", 0, 1);
if Ret == "0" then return false; end
sFile = Memory.GetString(pData, -1, "Ascii");
Memory.Free(pData);
if nFlag > 0 then
bDir = File.GetAttributes(sFile).Directory;
if nFlag == 1 and not bDir then
local tPaths = String.SplitPath(sFile);
tData[#tData + 1] = tPaths.Filename..tPaths.Extension;
elseif nFlag == 2 and bDir then
tData[#tData + 1] = _GetFolderName(sFile) .. " <-- this is a folder";
end
else
if File.GetAttributes(sFile).Directory then
tData[#tData + 1] = _GetFolderName(sFile) .. " <-- this is a folder";
else
local tPaths = String.SplitPath(sFile);
tData[#tData + 1] = tPaths.Filename..tPaths.Extension;
end
end
end
return (#tData == 0) and nil or tData;
end
WinAPI.DragFinish = function (hDrop)
DLL.CallFunction("shell32.dll", "DragFinish", hDrop, 1, 1);
end
Callback = function(hWnd, uMsg, wParam, lParam)
if uMsg == 563 then
local tFileList = WinAPI.DragQueryFileEx(wParam, tonumber(Page.GetRadioValue("1", RADIOGROUP_VALUE)));
if tFileList then
ListBox.DeleteItem("ListBox1", -1);
for i = 1, #tFileList do
ListBox.AddItem("ListBox1", tFileList[i], tFileList[i]);
end
end
WinAPI.DragFinish(wParam);
return 0;
end
end
function QueryAllowProjectClose()
Memory.FreeWindowSubClass(10);
return true;
end
_ShowRadioButton = function(b)
for i = 1, 3 do
RadioButton.SetEnabled("RadioButton"..i, b);
end
end
_GetFolderName = function (s)
s = String.TrimRight(s, "\\");
local nPos = String.ReverseFind(s, "\\", false);
if nPos ~= -1 then
return String.Mid(s, nPos + 1, -1);
end
return s;
end
-- îáðàáîò÷èê ñèñòåìíîãî ñîîáùåíèÿ WM_DROPFILES
Memory.CreateWindowSubClass(ListBox.GetProperties("ListBox1").WindowHandle, 10, "Callback");
WinAPI.DragAcceptFiles(ListBox.GetProperties("ListBox1").WindowHandle, CheckBox.GetChecked(this));
_ShowRadioButton(CheckBox.GetChecked(this));
local tFileList = WinAPI.DragQueryFileEx(wParam, tonumber(Page.GetRadioValue("1", RADIOGROUP_VALUE)));
Yo si que no entiendo nada jajajajajaja!nolram escribió:estuve investigando sobre el tema y encontré que también lo puedes hacer solamente habilitando en el listboxEx la acción para que acepte archivos arrastrándolos
se llama setAcceptFiles y hay otra se llama GetaAcceptFiles y otra GetDroppedfiles (=de esta hay un ejemplo dentro de la ayuda de la accion)creo que la primera va en la pestaña On Create y para el resto del las acciones En la pestaña Droppfiles CREOO!!!)
con esto ya puedes arrastra archivos al plugin
pero no supe como hacer para que se agregue el nombre del item la extensión y el resto jajajajajaj
espero tu si puedas para yo poder copiarlo a mi proyecto jajajaj
Suerte
Pues usando el ejemplo que yo he puesto antes.... usando shell32 y memory...sarumanice escribió:disculpen que me meta, pero si quiero arrastras un archivo a un simple "Imput" y que en el "Imput" me escriba la ruta del archivo arrastrado como sería?