By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,760 Members | 1,644 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,760 IT Pros & Developers. It's quick & easy.

DragDrop Question

P: n/a
Hi All,

My question is on DragDrop,

How would I implement a Drag from listview and Drop on Desktop or any other
folder on the computer.

The listview contains list of files, so basically I should be able to drop
those files on other folders in my computer.

I hope that's possible in .net 2.0

Thanks

Ratnesh
Apr 6 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
bump

if anybody knows the answer

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:eF**************@TK2MSFTNGP04.phx.gbl...
Hi All,

My question is on DragDrop,

How would I implement a Drag from listview and Drop on Desktop or any
other folder on the computer.

The listview contains list of files, so basically I should be able to drop
those files on other folders in my computer.

I hope that's possible in .net 2.0

Thanks

Ratnesh


Apr 18 '07 #2

P: n/a

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
bump

if anybody knows the answer

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:eF**************@TK2MSFTNGP04.phx.gbl...
>Hi All,

My question is on DragDrop,

How would I implement a Drag from listview and Drop on Desktop or any
other folder on the computer.

The listview contains list of files, so basically I should be able to
drop those files on other folders in my computer.

I hope that's possible in .net 2.0

Thanks

Ratnesh


Ratnesh,

I am at work right now so I don't have access to my home PC. I do have a
sample of drag and drop of files. It is quite simple but I will post a
little of the code when I get home.

LS

Apr 19 '07 #3

P: n/a

"Lloyd Sheen" <a@b.cwrote in message
news:8A**********************************@microsof t.com...
>
"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>bump

if anybody knows the answer

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:eF**************@TK2MSFTNGP04.phx.gbl...
>>Hi All,

My question is on DragDrop,

How would I implement a Drag from listview and Drop on Desktop or any
other folder on the computer.

The listview contains list of files, so basically I should be able to
drop those files on other folders in my computer.

I hope that's possible in .net 2.0

Thanks

Ratnesh



Ratnesh,

I am at work right now so I don't have access to my home PC. I do have a
sample of drag and drop of files. It is quite simple but I will post a
little of the code when I get home.

LS
Ratnesh,

Here is some sample code:

The following are variables used for the D&D processsing of mouse moves.

Private _MouseDown As Boolean = False
Private _MouseX As Integer
Private _MouseY As Integer
Private _MouseButtons As MouseButtons
Private _SwitchContext As Boolean = False

The following happens when the mouse button is pressed over my listview

Private Sub List_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseDown
_MouseButtons = e.Button
_SwitchContext = False
_MouseDown = True
_MouseX = e.X
_MouseY = e.Y
End Sub

The following happens on a move of the mouse. I use a test for the distance
the mouse has moved to prevent false drag drop operations:

Private Sub List_MouseMove(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseMove
Dim lv As ListView = DirectCast(sender, ListView)
Dim sc As New StringCollection

If _MouseDown Then
If Math.Abs(_MouseX - e.X) < 5 Or Math.Abs(_MouseY - e.Y) < 5
Then
Exit Sub
End If
Dim xx As DataObject = New DataObject
Dim yy As ArrayList = New ArrayList
For Each idx As Integer In lv.SelectedIndices
Dim li As ListViewItem = lv.Items(idx)
yy.Add(li.SubItems(5).Text + "\" + li.Text)
sc.Add(li.SubItems(5).Text + "\" + li.Text)
Next

Dim zz As Array = yy.ToArray
xx.SetFileDropList(sc)
xx.SetData("ListItems", lv.SelectedItems)
Try
lv.DoDragDrop(xx, DragDropEffects.Copy)
_MouseDown = False
Catch ex As Exception
Dim zzzz As Integer = 1
End Try

End If
End Sub

The following will reset the D&D if the mouse button is release over the
listview:

Private Sub SongFileView_MouseUp(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseUp
_MouseDown = False
End Sub
Hope this helps:

Lloyd Sheen

Apr 19 '07 #4

P: n/a

"Lloyd Sheen" <a@b.cwrote in message
news:06**********************************@microsof t.com...
>
"Lloyd Sheen" <a@b.cwrote in message
news:8A**********************************@microsof t.com...
>>
"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>bump

if anybody knows the answer

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:eF**************@TK2MSFTNGP04.phx.gbl...
Hi All,

My question is on DragDrop,

How would I implement a Drag from listview and Drop on Desktop or any
other folder on the computer.

The listview contains list of files, so basically I should be able to
drop those files on other folders in my computer.

I hope that's possible in .net 2.0

Thanks

Ratnesh


Ratnesh,

I am at work right now so I don't have access to my home PC. I do have
a sample of drag and drop of files. It is quite simple but I will post
a little of the code when I get home.

LS
Ratnesh,

Here is some sample code:

The following are variables used for the D&D processsing of mouse moves.

Private _MouseDown As Boolean = False
Private _MouseX As Integer
Private _MouseY As Integer
Private _MouseButtons As MouseButtons
Private _SwitchContext As Boolean = False

The following happens when the mouse button is pressed over my listview

Private Sub List_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseDown
_MouseButtons = e.Button
_SwitchContext = False
_MouseDown = True
_MouseX = e.X
_MouseY = e.Y
End Sub

The following happens on a move of the mouse. I use a test for the
distance the mouse has moved to prevent false drag drop operations:

Private Sub List_MouseMove(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseMove
Dim lv As ListView = DirectCast(sender, ListView)
Dim sc As New StringCollection

If _MouseDown Then
If Math.Abs(_MouseX - e.X) < 5 Or Math.Abs(_MouseY - e.Y) < 5
Then
Exit Sub
End If
Dim xx As DataObject = New DataObject
Dim yy As ArrayList = New ArrayList
For Each idx As Integer In lv.SelectedIndices
Dim li As ListViewItem = lv.Items(idx)
yy.Add(li.SubItems(5).Text + "\" + li.Text)
sc.Add(li.SubItems(5).Text + "\" + li.Text)
Next

Dim zz As Array = yy.ToArray
xx.SetFileDropList(sc)
xx.SetData("ListItems", lv.SelectedItems)
Try
lv.DoDragDrop(xx, DragDropEffects.Copy)
_MouseDown = False
Catch ex As Exception
Dim zzzz As Integer = 1
End Try

End If
End Sub

The following will reset the D&D if the mouse button is release over the
listview:

Private Sub SongFileView_MouseUp(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseUp
_MouseDown = False
End Sub
Hope this helps:

Lloyd Sheen
Well, it helped *me*! Thanks!

Robin S.
Apr 20 '07 #5

P: n/a
Hey Lloyd Sheen,

Thanks for the help, that code really works.

But I am still getting some problem. Because I am trying to implement a
listview, in which
1. I am dragging files from explorer and droping in it,
2. Dragging files inside listview to another folder,
3. Dragging files from listview and dropping in windows explorer.

and trying to make everything work is giving problems

Thnx for your snippet.

R
"Lloyd Sheen" <a@b.cwrote in message
news:06**********************************@microsof t.com...
>
"Lloyd Sheen" <a@b.cwrote in message
news:8A**********************************@microsof t.com...
>>
"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>bump

if anybody knows the answer

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:eF**************@TK2MSFTNGP04.phx.gbl...
Hi All,

My question is on DragDrop,

How would I implement a Drag from listview and Drop on Desktop or any
other folder on the computer.

The listview contains list of files, so basically I should be able to
drop those files on other folders in my computer.

I hope that's possible in .net 2.0

Thanks

Ratnesh


Ratnesh,

I am at work right now so I don't have access to my home PC. I do have a
sample of drag and drop of files. It is quite simple but I will post a
little of the code when I get home.

LS
Ratnesh,

Here is some sample code:

The following are variables used for the D&D processsing of mouse moves.

Private _MouseDown As Boolean = False
Private _MouseX As Integer
Private _MouseY As Integer
Private _MouseButtons As MouseButtons
Private _SwitchContext As Boolean = False

The following happens when the mouse button is pressed over my listview

Private Sub List_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseDown
_MouseButtons = e.Button
_SwitchContext = False
_MouseDown = True
_MouseX = e.X
_MouseY = e.Y
End Sub

The following happens on a move of the mouse. I use a test for the
distance the mouse has moved to prevent false drag drop operations:

Private Sub List_MouseMove(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseMove
Dim lv As ListView = DirectCast(sender, ListView)
Dim sc As New StringCollection

If _MouseDown Then
If Math.Abs(_MouseX - e.X) < 5 Or Math.Abs(_MouseY - e.Y) < 5
Then
Exit Sub
End If
Dim xx As DataObject = New DataObject
Dim yy As ArrayList = New ArrayList
For Each idx As Integer In lv.SelectedIndices
Dim li As ListViewItem = lv.Items(idx)
yy.Add(li.SubItems(5).Text + "\" + li.Text)
sc.Add(li.SubItems(5).Text + "\" + li.Text)
Next

Dim zz As Array = yy.ToArray
xx.SetFileDropList(sc)
xx.SetData("ListItems", lv.SelectedItems)
Try
lv.DoDragDrop(xx, DragDropEffects.Copy)
_MouseDown = False
Catch ex As Exception
Dim zzzz As Integer = 1
End Try

End If
End Sub

The following will reset the D&D if the mouse button is release over the
listview:

Private Sub SongFileView_MouseUp(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseUp
_MouseDown = False
End Sub
Hope this helps:

Lloyd Sheen

Apr 23 '07 #6

P: n/a

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:uS**************@TK2MSFTNGP04.phx.gbl...
Hey Lloyd Sheen,

Thanks for the help, that code really works.

But I am still getting some problem. Because I am trying to implement a
listview, in which
1. I am dragging files from explorer and droping in it,
2. Dragging files inside listview to another folder,
3. Dragging files from listview and dropping in windows explorer.

and trying to make everything work is giving problems

Thnx for your snippet.

R
"Lloyd Sheen" <a@b.cwrote in message
news:06**********************************@microsof t.com...
>>
"Lloyd Sheen" <a@b.cwrote in message
news:8A**********************************@microso ft.com...
>>>
"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl.. .
bump

if anybody knows the answer

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:eF**************@TK2MSFTNGP04.phx.gbl...
Hi All,
>
My question is on DragDrop,
>
>
>
How would I implement a Drag from listview and Drop on Desktop or any
other folder on the computer.
>
The listview contains list of files, so basically I should be able to
drop those files on other folders in my computer.
>
>
>
I hope that's possible in .net 2.0
>
>
>
Thanks
>
Ratnesh
>
>

Ratnesh,

I am at work right now so I don't have access to my home PC. I do have
a sample of drag and drop of files. It is quite simple but I will post
a little of the code when I get home.

LS
Ratnesh,

Here is some sample code:

The following are variables used for the D&D processsing of mouse moves.

Private _MouseDown As Boolean = False
Private _MouseX As Integer
Private _MouseY As Integer
Private _MouseButtons As MouseButtons
Private _SwitchContext As Boolean = False

The following happens when the mouse button is pressed over my listview

Private Sub List_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseDown
_MouseButtons = e.Button
_SwitchContext = False
_MouseDown = True
_MouseX = e.X
_MouseY = e.Y
End Sub

The following happens on a move of the mouse. I use a test for the
distance the mouse has moved to prevent false drag drop operations:

Private Sub List_MouseMove(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseMove
Dim lv As ListView = DirectCast(sender, ListView)
Dim sc As New StringCollection

If _MouseDown Then
If Math.Abs(_MouseX - e.X) < 5 Or Math.Abs(_MouseY - e.Y) < 5
Then
Exit Sub
End If
Dim xx As DataObject = New DataObject
Dim yy As ArrayList = New ArrayList
For Each idx As Integer In lv.SelectedIndices
Dim li As ListViewItem = lv.Items(idx)
yy.Add(li.SubItems(5).Text + "\" + li.Text)
sc.Add(li.SubItems(5).Text + "\" + li.Text)
Next

Dim zz As Array = yy.ToArray
xx.SetFileDropList(sc)
xx.SetData("ListItems", lv.SelectedItems)
Try
lv.DoDragDrop(xx, DragDropEffects.Copy)
_MouseDown = False
Catch ex As Exception
Dim zzzz As Integer = 1
End Try

End If
End Sub

The following will reset the D&D if the mouse button is release over the
listview:

Private Sub SongFileView_MouseUp(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseUp
_MouseDown = False
End Sub
Hope this helps:

Lloyd Sheen

When you say problems, what are the problems. For a drag from explorer to
your listview you will get the DataObject passed and check to ensure that
correct format is available for what you need to do.

Lloyd

Apr 24 '07 #7

P: n/a

"Lloyd Sheen" <a@b.cwrote in message
news:43**********************************@microsof t.com...
>
"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:uS**************@TK2MSFTNGP04.phx.gbl...
>Hey Lloyd Sheen,

Thanks for the help, that code really works.

But I am still getting some problem. Because I am trying to implement a
listview, in which
1. I am dragging files from explorer and droping in it,
2. Dragging files inside listview to another folder,
3. Dragging files from listview and dropping in windows explorer.

and trying to make everything work is giving problems

Thnx for your snippet.

R
"Lloyd Sheen" <a@b.cwrote in message
news:06**********************************@microso ft.com...
>>>
"Lloyd Sheen" <a@b.cwrote in message
news:8A**********************************@micros oft.com...

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl. ..
bump
>
if anybody knows the answer
>
"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:eF**************@TK2MSFTNGP04.phx.gbl.. .
>Hi All,
>>
>My question is on DragDrop,
>>
>>
>>
>How would I implement a Drag from listview and Drop on Desktop or any
>other folder on the computer.
>>
>The listview contains list of files, so basically I should be able to
>drop those files on other folders in my computer.
>>
>>
>>
>I hope that's possible in .net 2.0
>>
>>
>>
>Thanks
>>
>Ratnesh
>>
>>
>
>

Ratnesh,

I am at work right now so I don't have access to my home PC. I do have
a sample of drag and drop of files. It is quite simple but I will post
a little of the code when I get home.

LS
Ratnesh,

Here is some sample code:

The following are variables used for the D&D processsing of mouse moves.

Private _MouseDown As Boolean = False
Private _MouseX As Integer
Private _MouseY As Integer
Private _MouseButtons As MouseButtons
Private _SwitchContext As Boolean = False

The following happens when the mouse button is pressed over my listview

Private Sub List_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseDown
_MouseButtons = e.Button
_SwitchContext = False
_MouseDown = True
_MouseX = e.X
_MouseY = e.Y
End Sub

The following happens on a move of the mouse. I use a test for the
distance the mouse has moved to prevent false drag drop operations:

Private Sub List_MouseMove(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseMove
Dim lv As ListView = DirectCast(sender, ListView)
Dim sc As New StringCollection

If _MouseDown Then
If Math.Abs(_MouseX - e.X) < 5 Or Math.Abs(_MouseY - e.Y) < 5
Then
Exit Sub
End If
Dim xx As DataObject = New DataObject
Dim yy As ArrayList = New ArrayList
For Each idx As Integer In lv.SelectedIndices
Dim li As ListViewItem = lv.Items(idx)
yy.Add(li.SubItems(5).Text + "\" + li.Text)
sc.Add(li.SubItems(5).Text + "\" + li.Text)
Next

Dim zz As Array = yy.ToArray
xx.SetFileDropList(sc)
xx.SetData("ListItems", lv.SelectedItems)
Try
lv.DoDragDrop(xx, DragDropEffects.Copy)
_MouseDown = False
Catch ex As Exception
Dim zzzz As Integer = 1
End Try

End If
End Sub

The following will reset the D&D if the mouse button is release over the
listview:

Private Sub SongFileView_MouseUp(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseUp
_MouseDown = False
End Sub
Hope this helps:

Lloyd Sheen

When you say problems, what are the problems. For a drag from explorer to
your listview you will get the DataObject passed and check to ensure that
correct format is available for what you need to do.

Lloyd
Hi Lloyd,

The problems are,

For a drag from explorer to listview, i get the dataobjects -- which are
files.
For a drag within listview, i have to pass dataobjects -- which are
listviewitems. ( so you can drop them within another folder inside listview)
For a drag from listview to explorer, i've to pass dataobjects -- which are
files (listviewitems but for explorer i've to pass them as files)

so basically, when dragging out from listview , I am not sure how to
detect, if somebody is going to drop them in listview itself or in the
explorer.
so i pass the items on listview to Dataobjects either as files or as
listviewitems.

I think i made it clear to understand.

Thanks
R
Apr 30 '07 #8

P: n/a

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>
"Lloyd Sheen" <a@b.cwrote in message
news:43**********************************@microsof t.com...
>>
"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:uS**************@TK2MSFTNGP04.phx.gbl...
>>Hey Lloyd Sheen,

Thanks for the help, that code really works.

But I am still getting some problem. Because I am trying to implement a
listview, in which
1. I am dragging files from explorer and droping in it,
2. Dragging files inside listview to another folder,
3. Dragging files from listview and dropping in windows explorer.

and trying to make everything work is giving problems

Thnx for your snippet.

R
"Lloyd Sheen" <a@b.cwrote in message
news:06**********************************@micros oft.com...

"Lloyd Sheen" <a@b.cwrote in message
news:8A**********************************@micro soft.com...
>
"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl.. .
>bump
>>
>if anybody knows the answer
>>
>"Ratnesh Raval" <ra**********@gmail.comwrote in message
>news:eF**************@TK2MSFTNGP04.phx.gbl. ..
>>Hi All,
>>>
>>My question is on DragDrop,
>>>
>>>
>>>
>>How would I implement a Drag from listview and Drop on Desktop or
>>any other folder on the computer.
>>>
>>The listview contains list of files, so basically I should be able
>>to drop those files on other folders in my computer.
>>>
>>>
>>>
>>I hope that's possible in .net 2.0
>>>
>>>
>>>
>>Thanks
>>>
>>Ratnesh
>>>
>>>
>>
>>
>
Ratnesh,
>
I am at work right now so I don't have access to my home PC. I do
have a sample of drag and drop of files. It is quite simple but I
will post a little of the code when I get home.
>
LS
Ratnesh,

Here is some sample code:

The following are variables used for the D&D processsing of mouse
moves.

Private _MouseDown As Boolean = False
Private _MouseX As Integer
Private _MouseY As Integer
Private _MouseButtons As MouseButtons
Private _SwitchContext As Boolean = False

The following happens when the mouse button is pressed over my listview

Private Sub List_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseDown
_MouseButtons = e.Button
_SwitchContext = False
_MouseDown = True
_MouseX = e.X
_MouseY = e.Y
End Sub

The following happens on a move of the mouse. I use a test for the
distance the mouse has moved to prevent false drag drop operations:

Private Sub List_MouseMove(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongFileView.MouseMove
Dim lv As ListView = DirectCast(sender, ListView)
Dim sc As New StringCollection

If _MouseDown Then
If Math.Abs(_MouseX - e.X) < 5 Or Math.Abs(_MouseY - e.Y) <
5 Then
Exit Sub
End If
Dim xx As DataObject = New DataObject
Dim yy As ArrayList = New ArrayList
For Each idx As Integer In lv.SelectedIndices
Dim li As ListViewItem = lv.Items(idx)
yy.Add(li.SubItems(5).Text + "\" + li.Text)
sc.Add(li.SubItems(5).Text + "\" + li.Text)
Next

Dim zz As Array = yy.ToArray
xx.SetFileDropList(sc)
xx.SetData("ListItems", lv.SelectedItems)
Try
lv.DoDragDrop(xx, DragDropEffects.Copy)
_MouseDown = False
Catch ex As Exception
Dim zzzz As Integer = 1
End Try

End If
End Sub

The following will reset the D&D if the mouse button is release over
the listview:

Private Sub SongFileView_MouseUp(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
SongFileView.MouseUp
_MouseDown = False
End Sub
Hope this helps:

Lloyd Sheen

When you say problems, what are the problems. For a drag from explorer
to your listview you will get the DataObject passed and check to ensure
that correct format is available for what you need to do.

Lloyd

Hi Lloyd,

The problems are,

For a drag from explorer to listview, i get the dataobjects -- which are
files.
For a drag within listview, i have to pass dataobjects -- which are
listviewitems. ( so you can drop them within another folder inside
listview)
For a drag from listview to explorer, i've to pass dataobjects -- which
are files (listviewitems but for explorer i've to pass them as files)

so basically, when dragging out from listview , I am not sure how to
detect, if somebody is going to drop them in listview itself or in the
explorer.
so i pass the items on listview to Dataobjects either as files or as
listviewitems.

I think i made it clear to understand.

Thanks
R
I am not sure why you would have to have two different situations. Simply
pick the way that works with the external program in this case Explorer and
then ensure that your application will respond in the same manner. In my
app the listview items do represent files and by creating the dataobjects I
can drag from Windows into my app and from my app into windows.

If there is something I am missing please let me know I and I will see if I
can help.

Lloyd Sheen

Apr 30 '07 #9

P: n/a
>>
>Hi Lloyd,

The problems are,

For a drag from explorer to listview, i get the dataobjects -- which are
files.
For a drag within listview, i have to pass dataobjects -- which are
listviewitems. ( so you can drop them within another folder inside
listview)
For a drag from listview to explorer, i've to pass dataobjects -- which
are files (listviewitems but for explorer i've to pass them as files)

so basically, when dragging out from listview , I am not sure how to
detect, if somebody is going to drop them in listview itself or in the
explorer.
so i pass the items on listview to Dataobjects either as files or as
listviewitems.

I think i made it clear to understand.

Thanks
R

I am not sure why you would have to have two different situations. Simply
pick the way that works with the external program in this case Explorer
and then ensure that your application will respond in the same manner. In
my app the listview items do represent files and by creating the
dataobjects I can drag from Windows into my app and from my app into
windows.

If there is something I am missing please let me know I and I will see if
I can help.

Lloyd Sheen
my listview works as file explorer. so there are 3 situations
1. drag file from explorer -- drop in listview
2. drag file from listview ---drop in explorer.
3. drag file from listview ---drop inside the same listview but inside
some folder which is shown in the listview

if you look in your case, what if you want to move some file inside some
folder in listview itself ( not in the explorer),

if you want i will post it with codes.

R
Apr 30 '07 #10

P: n/a

"Ratnesh Raval" <ra**********@gmail.comwrote in message
news:uv**************@TK2MSFTNGP02.phx.gbl...
>>>
Hi Lloyd,

The problems are,

For a drag from explorer to listview, i get the dataobjects -- which
are files.
For a drag within listview, i have to pass dataobjects -- which are
listviewitems. ( so you can drop them within another folder inside
listview)
For a drag from listview to explorer, i've to pass dataobjects -- which
are files (listviewitems but for explorer i've to pass them as files)

so basically, when dragging out from listview , I am not sure how to
detect, if somebody is going to drop them in listview itself or in the
explorer.
so i pass the items on listview to Dataobjects either as files or as
listviewitems.

I think i made it clear to understand.

Thanks
R

I am not sure why you would have to have two different situations.
Simply pick the way that works with the external program in this case
Explorer and then ensure that your application will respond in the same
manner. In my app the listview items do represent files and by creating
the dataobjects I can drag from Windows into my app and from my app into
windows.

If there is something I am missing please let me know I and I will see if
I can help.

Lloyd Sheen

my listview works as file explorer. so there are 3 situations
1. drag file from explorer -- drop in listview
2. drag file from listview ---drop in explorer.
3. drag file from listview ---drop inside the same listview but inside
some folder which is shown in the listview

if you look in your case, what if you want to move some file inside some
folder in listview itself ( not in the explorer),

if you want i will post it with codes.

R

I don't have the 3rd case in my app but it would be the same. Each
dataobject is representative of one file. Then when the drop happens each
dataobject will be a file and the app can do the appropriate thing. Perhaps
you are refering to moving a file. In that case you would get the result of
the drag / drop (not in my code) and then if a copy occurred do (most likely
nothing) , a move would delete the file in the source etc.

If you use the code and drag a file from the explorer and then return a
"Move" result you should see the file disappear from folder in explorer.
You can do the same thing in your app.

Lloyd

Apr 30 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.