MerlinEl
11-18-2009, 11:41 AM
Hi
As an example:
TreeView contains items : #(dir_name1, dir_name2)
Property:
text = directory name
tag = directory path
ListView contains items : #(file_name1, file_name2, file_name3, file_name4)
Property:
text = filename
tag = filepath
--first Im using this code in ListView to drag the file from listView in to treeView
fn dragStart arg =
(
if listView.SelectedItems.Count == 0 do return false
current_list_item = listView.SelectedItems.Item[ 0 ] --get first item from selection
local intnum = dotnetobject "System.Int32" 0
local filenamestring= dotnetobject "System.string" current_list_item.tag
local dropfile = dotnetobject "System.String[]" 1
dropfile.setvalue filenamestring intnum
local DataObj = dotnetobject "DataObject" ((dotnetclass "DataFormats").filedrop) dropfile
listView.dodragdrop Dataobj ((dotnetclass "DragDropEffects").Copy)
)
--second Im detect hited node in TreeView and collect file data
on treeView DragOver send arg do
(
local mouseDPos = send.PointToClient send.MousePosition
local node = send.GetNodeAt mouseDPos.x mouseDPos.y
if node != undefined do send.SelectedNode =node
drag_file_data = arg.data -- Assing files collection in to Global Var
)
--thrid Im triyng here to move this file in hited dir
on treeView DragLeave send arg do
(
local mouseDPos = send.PointToClient send.MousePosition
local node = send.GetNodeAt mouseDPos.x mouseDPos.y
if node != undefined and drag_file_data != undefined do
(
local dl = drag_file_data.GetFileDropList() -- get file paths array
print dl.Item[0] --get first file path
--how to move the file in this dir?
--evry time when I do this operation .. the file is droped in to max iterface
--passed tough my dialog why?
)
)
I don’t know if is clear what I’m trying to do , if somebody understand I will be grateful for your suggestion.
As an example:
TreeView contains items : #(dir_name1, dir_name2)
Property:
text = directory name
tag = directory path
ListView contains items : #(file_name1, file_name2, file_name3, file_name4)
Property:
text = filename
tag = filepath
--first Im using this code in ListView to drag the file from listView in to treeView
fn dragStart arg =
(
if listView.SelectedItems.Count == 0 do return false
current_list_item = listView.SelectedItems.Item[ 0 ] --get first item from selection
local intnum = dotnetobject "System.Int32" 0
local filenamestring= dotnetobject "System.string" current_list_item.tag
local dropfile = dotnetobject "System.String[]" 1
dropfile.setvalue filenamestring intnum
local DataObj = dotnetobject "DataObject" ((dotnetclass "DataFormats").filedrop) dropfile
listView.dodragdrop Dataobj ((dotnetclass "DragDropEffects").Copy)
)
--second Im detect hited node in TreeView and collect file data
on treeView DragOver send arg do
(
local mouseDPos = send.PointToClient send.MousePosition
local node = send.GetNodeAt mouseDPos.x mouseDPos.y
if node != undefined do send.SelectedNode =node
drag_file_data = arg.data -- Assing files collection in to Global Var
)
--thrid Im triyng here to move this file in hited dir
on treeView DragLeave send arg do
(
local mouseDPos = send.PointToClient send.MousePosition
local node = send.GetNodeAt mouseDPos.x mouseDPos.y
if node != undefined and drag_file_data != undefined do
(
local dl = drag_file_data.GetFileDropList() -- get file paths array
print dl.Item[0] --get first file path
--how to move the file in this dir?
--evry time when I do this operation .. the file is droped in to max iterface
--passed tough my dialog why?
)
)
I don’t know if is clear what I’m trying to do , if somebody understand I will be grateful for your suggestion.
