Dragging And Dropping From One Listview To Another
Hi all,
How can I drag and drop multiple items including their subitems from one listview to another. Please help.
Thanks, Nitesh
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dragging And Dropping
Hi,
I'm trying to make a part of a program, but I'm just getting really stuck.
I need to be able to drag and drop jpeg files into image (or picture but preferably image) boxes from windows explorer.
Can anyone help?
Thanks,
Adrian Osmond.
Dragging And Dropping
Does anyone know how you can drag and drop and object to anywhere on the page? If i set dragmode to automatic i can drag it but it drops back to its previous location.
Dragging && Dropping
I have a textbox on my form named "Text1"...
This textbox has a drag/drop event that takes the path of the file dropped and makes it the Text1.text...
The problem with this is... it accepts any file type...
Is there a way to limit dragging/dropping to only certain file types?
(If possible, can I have only .exe's & .lnk files accepted by the drop, with everything else causing a "cannot drop" icon?)
-------------------------------------
!!!SOLVED!!!
The harder question...
In the previous question, I wanted .lnk files to be dropped too... The only problem with this is, when you try to shell() a .lnk file, it gives an error... So, do I need to extract the .exe filepath from the .lnk, or is there a way to correctly shell() a .lnk file?
If I do have to "extract" the filepath from the .lnk to the real .exe's filepath, how do I go about this?
!!!SOLVED!!!
I figured out the second question with the help of someone's example project on how to create shortcuts and gather information from them. I'm not sure who posted it, it was one of the gurus... Thanks whoever you are!
Help on the first question still needed!
Thanks!
Dragging And Dropping..
someone give me this code a few weeks back and it makes it so if you drag and drop picture 1, it makes a new copy of it in the location you just dropped it on. i wanted to know if, aswell as this, i could make it make a new "label1" and "label3" (examples, they won't be called that, just chose them for examples sake) with the same index number on the end in the same drag and drop instead of dragging and dropping them things aswell.
'add a picture box named picture1 and set index=0
Option Explicit
Dim picCount As Integer
Dim dx As Single, dy As Single
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Load Picture1(picCount + 1)
Picture1(picCount + 1).Left = X - dx
Picture1(picCount + 1).Top = Y - dy
Picture1(picCount + 1).Visible = True
picCount = picCount + 1
End Sub
Private Sub Picture1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
dx = X
dy = Y
End Sub
Dragging And Dropping..
Would it be possible to have it so there could be a picture on your form, you drag and drop it somewhere else and the original picture stays there but a new one which is identical appears in the place you dropped it and you could do it again to create a third one and then do it over and over again?
Dragging And Dropping
Ehh...
I wanted to play around with dragging and dropping from one list box to another. Problem is I want the List multi selectable .. which isn't the problem..the problem is if I set the DragIcon to some specific icon and I try to grab an item it doesnt show the item as being selected. I want to change the actual cursor when its over the list box which I can do. Does anyone have a nice example of dragging and dropping from one list box to another with a drag icon?
Thanks,
Jon
Dragging And Dropping
Let's say I have a listview w/ a list of files in it, and another empty listview.
How do I drag and drop so when I drag a file from the first listview to the second listview, the second listview adds a new entry (report view) w/ the path (text) of listview1?
The file should still be in listview1.
Dragging And Dropping
I was thinking about placing a new sectin into my program and was wondering if someone had done something similar before.
I am going to need to areas containing information. ONe of these areas(area a) is going to be popluated my a table (in a database) and the other one(area B) (not sure yet). I need to be able to drag from area b to area a and have the item disappear from area a and then appear in area a. (the new info will now be saved to the table.
another thing that I may need to do is to drag within area a but keeo the information in the original place as well.
anyone do this before??
Dragging And Dropping With Buttons
How do I determine which button was used to drag and drop a file? I have this code:
Private Sub lstFileName_OLEDragDrop(Data As DataObject, Effect _
as Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
PopupMenu mRightDrag
Else
'left drag
End If
... which is meant to allow normal drag&drop with the left mouse button, but show the mRightDrag menu if the right button was used. However, whichever button I use, the value of Button passed to the sub is 0. Is that because by the time a drop is completed the button has been released, and if so, what's the point of the Button parameter?
Resolution:
I'm using the OLEDragOver event to catch the button and save it in a public variable for use when the OLEDragDrop event triggers.
Dragging And Dropping Control?
I am coding to move the control panel around where I wanted to by dragging it. It doesn't move right. anyone can help?
Private xoffset as single, yoffset as single
Private Sub pnTT_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
xoffset = X
yoffset = Y
pnTT.Drag vbBeginDrag
End Sub
Private Sub pnTT_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
xoffset = 0
yoffset = 0
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - xoffset, Y - yoffset
End Sub
I am really aprreciate your help.
Dragging And Dropping Frames
I Have This Code To Drag My Frame
VB Code:
Private Sub Frame4_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) Dim OffsetX As IntegerDim OffsetY As Integer OffsetX = x OffsetY = y Frame4.Drag vbBeginDragEnd Sub
but that doesnt drop it
how do i drop the frame
Dragging And Dropping Outside Of A Treeview
I am attempting to create an application where a treeview has a hierarchal display of data, and the user can drag any item from the treeview to a textbox which is used to create a script.
My problem is this:
Say the root node is currently selected. When the user grabs an item which is not the root node, and drags it to the textbox, the root node is the only thing that gets moved.
If the user first clicks on the item (going through all mouse_down, mouse_up and node_click events) and then clicks and drags, it works fine.
But I'd like it so that the user doen't have to click twice (dragging with the second click) to drag an item outside of the treeview.
If the user drags the item around inside the treeview, the newly clicked node remains selected. But drag it out of the treeview and BAM! The originally selected node becomes selected again.
Any thoughts?
Thanks.
Dragging And Dropping Shortcut? (still Ned Help)
Is it possible, to drag a file (lets say from your desktop) onto your application you made, and the application will put the file you dragged into a specific folder on your hard drive?
If its possible, ever more specifically, is it possible to drag it into like a box on your application, and have 2 boxes that will put the file in 2 different folder, depending on what box you drop it into?
If this is all possible, plzplzplz tell me how.
I have been fooling around with VB for the past 2 hours trying to figure this out, but I cant find anything.
Can it be done with code?
Dragging && Dropping Between 2 Listviews
I have 2 Listviews.
Listview A is set to OLEDragmode Automatic
Listview B is set to OLEDropMode Manual.
I only ever want to be able to drag from A to B.
In the OLEDragDrop event of Listview B I am having trouble 'adding in' the dropped data.
Can someone help me out here ? I'm not very up on the Drag & Drop side of things at the moment, so am floundering a bit !
Thanks a lot.
Dragging And Dropping Gifs.
Is it possible to drag and drop a gif from one PictureBox onto another PictureBox on the same form? Do I have to set any of the properties in any particular way?
JP
Dragging And Dropping Object From A List Box
Hello,
I am writing a program where a user can drag and drop objects from a List Box onto a Report template.
Once the user drops the Item on the Report, the Item in the Listbox should be removed.
If the User drops it back into the ListBox, the Item must be added back.
Pl. suggest a method to do that...
Also I was using the Choose function as follows :
nIndex = lstObject.ListIndex + 1
nType = Choose(nIndex, OBJECT_TEXT, OBJECT_TEXT, OBJECT_PICTURE, OBJECT_LINE, OBJECT_LINE, OBJECT_RECTANGLE, OBJECT_PICTURE, OBJECT_PARAGRAPH, OBJECT_PARAGRAPH, OBJECT_PARAGRAPH, OBJECT_PARAGRAPH, OBJECT_PARAGRAPH, OBJECT_PARAGRAPH, OBJECT_PARAGRAPH, OBJECT_PARAGRAPH, OBJECT_PARAGRAPH)
But now I cannot use the ListIndex as that would change each time the User Drags & drops it back into the List box.
Any ideas / help will be appreciated.
Thank you,
Dragging And Dropping Pictures Into Another PictureBox
I have 2 picture boxes within the same Form, pic1 and pic2. At the moment I am using the code below to drag and drop the picture from pic1 to pic2, which is a much larger PictureBox. The idea being to build up a much larger picture.
private Sub pic1_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)
pic1.OLEDrag
End Sub
private Sub pic1_OLEStartDrag(Data as DataObject, AllowedEffects as Long)
Data.SetData pic1.Picture, vbCFBitmap
AllowedEffects = vbDropEffectMove
End Sub
private Sub pic2_OLEDragDrop(Data as DataObject, Effect as Long, Button as Integer, Shift as Integer, X as Single, Y as Single)
pic2.Picture = Data.GetData(vbCFBitmap)
End Sub
This code is working, but the picure from pic1 will always leap back to the top left corner of the pic2 PictureBox. What I want to have is the picure to stay exactly where it is placed within pic2. I know this must be possible, but I cannot find it in any of my books.
For the next part of my program I will need to use the coordinates of each picture I place into pic2 to use in some calculations. Is this going to be possible?
If anyone has any ideas I would be very grateful, as I am a bit stuck until I get past this problem!
Thanks for your time. Malc
Scroll The Treeview When Dragging And Dropping
The only information that I can find on scrolling a treeview when dragging and dropping a node is out on microsoft's support online - Article ID: Q177743
http://support.microsoft.com/suppor...s/q177/7/43.asp
The problem that I am having with is solution is that when the mouse button is released over an area other than the treeview area, it continues to scroll. It does not recognize that the mouse button has been released. It also continues to scroll is you drag it off the form, which microsoft applications do not do.
Does anyone have a fix for this or possibly a better solution?
Prevent User From Dragging And Dropping Mschart
I have an mschart control on a form.
I want to prevent the user from changing the position of the control on the form (by dragging and dropping) so I have set the DragMode property to Automatic.
This is only partially successful.
The user cannot actually move the chart but when they mousedown over it, a border appears around the chart and this can be dragged.
Is there any way to prevent the border appearing?
Dragging And Dropping Without Disabling Mouse Clicks
I'm trying to make it so that a control can be dragged and dropped onto another, but this disables the mouse click events. Is there anyway of still allowing the card to be clicked whilst also allowing it to be dragged with an outline?
TreeView - Dragging And Dropping A Node In The Middle Of A Level
Does anyone know how to drag and drop a node within a treeview control in the middle of a level on the same treeview control?
When I use the drag and drop methods, and drop my node on a level I can drop it as the first child under that level or I can drop it as the first node at the same level.
IfI have 5 nodes under a level and want to drop another node in between nodes 3 and 4, it will only drop it before node 1.
Does anyone out there have any codes samples that they are using themselves to do this?
I have search the internet for samples and can not find one that does this.
Different Kind Of Dragging And Dropping Between Two Tree View Controls
Suppose that there are two treeview controls say (tree1 and tree 2).now I want my application to drag a node in tree 1 and drop it on tree 2 when ever i click a command button.I do not want to manually select a node then drag it and then drop it.I want the whole operation of dragging and drropping be done automatically.
can anyone help me with my problem?Please it very important to me.
How To Disable Dragging/dropping The Windows Desktop Icons
Hi, friends,
I want to disable dragging/dropping the Windows desktop icons by a program. How can I do that? (eg. If a user drag an icon and drop it elsewhere, give a warn messagebox).
Also, I want to disable the "New" submenu in the pop-up menu after Right-clicking the mouse on the Windows desktop. How can I do
that by a program?
Highly appreciated!
ListView DRAGGING
How can I select multiple items by clicking and then dragging over the amount of records that are there?
thanks...
Listview - Turning Off Dragging
I'm in one of my old apps and noticed that for some reason I used a listview control when a listbox "might" have done the job. My comments aren't as good as they should be (lesson learned). Anyway, since I'm not sure why I used a listview instead of a listbox I'm not willing to replace it. I don't have the time.
So... Is there a property (that I can't find) that turns off dragging of items in the listview control?
Thanks,
Bernie
Dragging Listview Items
How to drag Listview Item to another form with the same format of Listview.??? hElp please??
Listview Dragging Item
Hello, Jusk asking if there is a possible way to drag item in the listview??
it goes like this:
Listview populate with;
Item 1
Item 2
Item 3
When I drag Item 3 to the position of Item2, it goes like this;
Item 1
Item 3
Item 2
is this possible?? if not?? what should I do??
ListView And Turning Off Dragging
I have Listview with a number of items and I want a user to be able to select an item by clicking on it. Currently, if they click and drag then the icon and text go flying all over the window. How do you keep them from being able to click and drag on the icons messing up the entire list view but still allow them to click and select one? There are a number of related posts but noone seems to have a straightforward answer and this seems easy. Help please!
Thanks.
Create Shortcut By Dragging From Listview
Was wondering if someone could show me an example of creating a windows shortcut by dragging an item out of a listview control and say onto the desktop.
When creating the shortcut I would like to link to a specifix .exe, but use what was dragged out as part of the command line parameters.
Thanks in advance
Listview: Disabling User Dragging
Is there a way to disable the user from dragging items in a listview. My listview.view=lvwIcon and has to stay that way (e.g. I need the nice large icons)
Thanks in advance,
Listview Setting No Column Dragging
Hi all
you know how with the listview columns you can drag them?
howdo i stop this or get it to resize as soon as the user drags it so its kind of asking howto set the drag to be undraggable
Tom
Dragging Multiple Items From A Listview
i have some code to let users drag an item from a listview onto a treeview node, which works fine, but now i want to let them drag multiple items.
the problem is that when then select a bunch of items, then drag them to the treeview, it leaves only the last item they clicked on selected (as if they selected them, then just left-clicked one of them). is there a way to keep them all selected?
also, just out of interest, is there a way to make the drag icon include some text from each selected listview item along with an icon (like when you drag multiple files in windows explorer)?
thanks for any help
Problem With ListView Control And Dragging
I'm trying to drag an item from one ListView control to another but whenever I click on any of the items the first item is selected no matter which I have clicked on. The drag outline does appear over the selected object though. The ListView control is in report view and all the other relevant code is below, can anyone suggest what I've done wrong?
Many thanks
Geoff
Setting up control:
Dim itmX As ListItem
lsvEvents.ListItems.Clear
lsvEvents.ColumnHeaders.Clear
lsvEvents.ColumnHeaders.Add , "Event", "Event", lsvEvents.Width / 2
lsvEvents.ColumnHeaders.Add , "Time", "Time", lsvEvents.Width / 2
lsvEvents.SmallIcons = imlLog
For each record in a recordset:
Set itmX = lsvEvents.ListItems.Add()
itmX.Text = !Name
itmX.Tag = !EventID
itmX.SubItems(1) = !OpenTime
Select Case !EventType
Case Is = "<Project File>"
itmX.SmallIcon = "Project"
Case Is = "<Resource File>"
itmX.SmallIcon = "Resource"
Case Is = "<Issue>"
itmX.SmallIcon = "Issue"
End Select
MouseDown:
Private Sub lstEvents_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim DY ' Declare variable.
DY = TextHeight("A") ' Get height of one line.
lblDrag.Move lstEvents.Left, lstEvents.Top + y - DY / 2, lstEvents.Width,
DY
lblDrag.Drag ' Drag label outline.
End Sub
Problem With ListView Control And Dragging
I'm trying to drag an item from one ListView control to another but whenever I click on any of the items the first item is selected no matter which I
have clicked on. The drag outline does appear over the selected object though. The ListView control is in report view and all the other relevant code is below, can anyone suggest what I've done wrong?
Many thanks
Geoff
Setting up control:
Dim itmX As ListItem
lsvEvents.ListItems.Clear
lsvEvents.ColumnHeaders.Clear
lsvEvents.ColumnHeaders.Add , "Event", "Event", lsvEvents.Width / 2
lsvEvents.ColumnHeaders.Add , "Time", "Time", lsvEvents.Width / 2
lsvEvents.SmallIcons = imlLog
For each record in a recordset:
Set itmX = lsvEvents.ListItems.Add()
itmX.Text = !Name
itmX.Tag = !EventID
itmX.SubItems(1) = !OpenTime
Select Case !EventType
Case Is = "<Project File>"
itmX.SmallIcon = "Project"
Case Is = "<Resource File>"
itmX.SmallIcon = "Resource"
Case Is = "<Issue>"
itmX.SmallIcon = "Issue"
End Select
MouseDown:
Private Sub lstEvents_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim DY ' Declare variable.
DY = TextHeight("A") ' Get height of one line.
lblDrag.Move lstEvents.Left, lstEvents.Top + y - DY / 2, lstEvents.Width,
DY
lblDrag.Drag ' Drag label outline.
End Sub
Stop Item Dragging/moving In ListView
Is there any way you can stop the user from moving the item position in a listview?? I need them to stay the same as i added them first by code, with them being fixed for the user and not allowing any movement of item position!
thanks!
Please Double Check This Dragging From ListBox To ListView Code For Me
I want to drag an item from a listbox to a listview so starting with my lisbox code:
Private DragID As Integer
Private blnAmDragging As Boolean
Code:
Private Sub lstUnalloc_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
DragID = lstUnalloc.ItemData(lstUnalloc.ListIndex)
End If
End Sub
Code:
Private Sub lstUnalloc_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error GoTo errh
If Button = vbLeftButton Then
If lstUnalloc.ListIndex >= 0 Then
blnAmDragging = True
lstUnalloc.Drag vbBeginDrag
End If
End If
Exit Sub
errh:
errmsg "The following Exception occured : " & Err.Description & ", " & Err.Source & "", "Exception occured in frmMain.lstUnalloc_MouseMove ()"
End Sub
and now my listview:
Code:
Private Sub lvwPeople_DragOver(Source As Control, x As Single, y As Single, State As Integer)
On Error GoTo errh
If blnAmDragging = True Then
If State = vbLeave Then
Set lvwPeople.DropHighlight = Nothing
Else
Set lvwPeople.DropHighlight = lvwPeople.HitTest(x, y)
End If
End If
Exit Sub
errh:
errmsg "The following Exception occured : " & Err.Description & ", " & Err.Source & "", "Exception occured in frmMain.lstlist_DragOver()"
End Sub
Code:
Private Sub lvwPeople_DragDrop(Source As Control, x As Single, y As Single)
If Source = "lvwPeople" Then
Exit Sub
End If
Source.Drag vbEndDrag
Set lvwPeople.SelectedItem = lvwPeople.HitTest(x, y)
MsgBox lvwPeople.SelectedItem.Key
MsgBox DragID
End Sub
I just put 2 msgboxes to test. I have to write sql statements to assign the number to a person. I just need someone to check if I am doing the correct stuff for dragging and dropping.
Application Dropping Out
I have an application which periodically drops out of it's processing sequence
eg, I call a subroutine which starts off with a series of Dim statements. When the the Dim Statements have completed, it drops back to the calling procedure (which is the symptom of an error taking place).
This happens maybe once every 20 times the program is run.
I am wondering what may cause this - I am guessing that the memory can't take any more variables ???
Is this what would happen if the memory was full ?
Or is it some other problem I should be looking for ?
Restarting the computer and re-running the program always works fine.
Appreciate any comments - this one has me stumped
Dropping Global Variables
I have a module in Access that sets the globals for the program. I have run into a weird problem. The global variables drops their values sporadically. There is no pattern to the problem. Has anyone else encountered the same or similar problem?
Thanks,
Animual
|