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
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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
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
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.
Dragging In Tab Control
He,
I need to have the capability to switch between tabs by dragging the tab to the desired location.
I don't have any idea how to do it !
Any idea will be really helpfull
Thanks
Sigal
Dragging A Control Along With Your Program
Is there a way to have your program carry a SysInfo control on its back? So that when I copy my program into another computer (it's a USB key backup program) it doesn't cause an error when it can't find the control?
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 A Shape Control
I've been working on a class that will allow me to draw a rectangle on a form and then be able to stretch it by dragging the sides or corners. (Eventually I plan on incorporating it in my Picture Viewer app so that I can crop pictures.) I've run into a problem that has had me stumped for two days and maybe some fresh eyes will find it.
To reproduce the problem, run the app and draw a rectangle on form by clicking the mouse and dragging it. When you do that the rectangle will be drawn very smoothly by dragging its lower right-hand corner. Now release the mouse and move it over the edges of the rectangle and you'll see that "grab handles" appear. So far so good, but now move the mouse to the lower right-hand corner so that the "northwest" grab handle appears there and attempt to drag that corner. The problem is that while you can do it slowly for a while the mouse will eventually "jump off" the rectangle without the mouse_up event having been fired. Note that both the DrawInitial procedure that is used to initially draw the rectangle and the Stretch procedure that is used to stretch it after it's drawn both use the same StretchFromBottomRight procedure so I really don't understand why it doesn't work the same both times.
Dragging An Image Control
Hi Guys
I wish to know how best can i facilitate moving of an Image control at runtime by dragging throug a mouse (with little or no flickering at all).
Regards
Suhaib
Dragging Control - Keep Inside It's Container?
Hi,
I have an image control inside a picturebox. So the picturebox is the image controls container.
I can move the image control about inside the picturebox just fine, but I would like to restrict it to the boundary of the picturebox. I can do this but when you drag the image control up against one of the picturebox's borders the image begins to shake and flash.
So what I'm asking is how can I make it remain solid when it's up against the picturebox's border? I'm sure it's something simple, but I just can't seem to think of a way. :/ I attached an example project.
Stop Dragging Links From Webbrowser Control
Hi all,
i'm creating a securelink browser application using
WebBrowser cotrol in VB6.
Our requirment is that no one can't do drag and drop
a hyperlink out side the application ,as one can do
with other browsers.
so how can i do this ,plz help me.
Thanks
[Read] Need Help With Custom Scrollbars On A Listview Control! Or Skinning Listview..
I have been searching for weeks now to find a way to use a custom scrollbar to scroll a listview...
Like this:
Now I use an alternating BG function on my listview and I am currently using the ensurevisible method of scrolling a listview...
Is there a better way?
I will post some example projects if needed...
But how would I use a custom scrollbar on a listview control
Thanks for helping
Using A ComboBox Control To Edit Data In A ListView Control?
Hello everyone!
I am looking for a way to add a combobox inside a listview control
in order to let the user change data.
I have found the following code from google:
http://www.kbalertz.com/kb_Q320342.aspx
but I' m having problems converting it into VB6,
especially with the mouseup event of the listview.
Can anybody help?
I think it's a question of much interest to many of us.
Thanks in advance!
Using A ComboBox Control To Edit Data In A ListView Control?
Hello everyone!
I am looking for a way to add a combobox inside a listview control
in order to let the user change data.
I have found the following code from google:
http://www.kbalertz.com/kb_Q320342.aspx
but I' m having problems converting it into VB6,
especially with the mouseup event of the listview.
Can anybody help?
I think it's a question of much interest to many of us.
Thanks in advance!
ListView And Control
Do you have an example, which show how to implement Combo box or Any Control into a listview control. And how to use these controls.
I used the search tool, but i ve found nothing.
Thanks for your help !!
ListView Control
I am making a program which creates files and displays the contents on a listview control (well that's the general outline).
after opening the random file, getting the length of a record and iterating through the records to find which ones match a criteria and error appears reading "Index unavailable". I have noticed that this error occurs due to the first record matching the criteria is not the first in the file.
How do i solve this dilema? I want to be able to search the file and add any record (from any place in the file) to the List view control.
PLEASE HELP!!
Listview Control
Hello all,
I've been using Listviews for some time now, and have noticed that sometimes the subitems don't populate, although the data is there ie
I run a SQL query on a database everything appears in the listview now I could run the same query straight away and only column one is populated, it may not neccessarly be the second attepmt either it seems to happen as and when it feels like it (but never the first time) the only way to get the display beck is to close the app and restart it.
Any suggestions as to why
nb: I am clearing the list before each query is run
Need Help In Listview Control
can u guys help me in this part of the code
i dont know how to search an item in the listview which is in subitem then edit it
Is There A Better Listview Control Out There?
I have a program that uses 3 Listviews as "Playlist Holders" and i was wondering if there was a better controll out there with more functionality.
An example would be, seeting the background color of a row and so forth.
Thanks
ZeroEffect
ListView Control
I am using a listview control on a form to display all records in a database. I have 14 seperate columns. I am trying to use the finditem property to search for info in the columns after the listview control has been populated. I have figured out how to acess the first 2 columns and have hit a dead end on the others. Also I would like to be able to search for multiple occurences of the item I am searching for. Incase it matters the search data will be used for viewing purposes only. Any help one can provide would be greatly appreciated.
Something About ListView Control
Hi !
I want to use Listview control in visual basic 6. But i dont found it in the component's list .( i.e, Project-> Components)
Can any one tell me where to get it or may be its name is different or its on some other location ?
ListView Control
Hello,
I am creating a settings form that allows the user to change various aspects of a program. This question pretains to the lstview control. If the user changes his or her background from a graphic to just solid color, is there any way to check for this using code. For example, I have two option buttons asking which the user wants (graphic or solid color). If the user switches to solid color and then pushes Change Color and changes the color to orange and hits Apply, the specified change occurs as it should. However, if the user reopens the settings menu, I have no clue how the settings form can check to see whether the user has a solid background or a graphic background and select the appropriate option button indicating the users current mode (either graphic or solid color). I hope this is clear, although it probably isn't . Let me know if you need any clarification and I'll try to provide it... Thanks.
Audax321
ListView Control
Does anyone know how to trap the "Scroll" event of a ListView Control?
VB6-SP5
Win2000-SP2
Is This Possible With A ListView Control???
I want to know if it is possible to put a different small icon for each row of a ListView control. Since I am making a program that displays game servers, I need to display an icon for each server that describes the server (secure, password-protected, proxy, dedicated, linux or Win32, etc). Is this possible with the ListView control, or if not, then which similar control can I use that allows this?
Thanks in advance.
Listview Control
I have a listview control on my form and it seems to load really slow. When the form is first loaded and the listview control loads, it seems to load pretty fast but if I reload the list, by clicking a button on the form, it loads really slow. If I unload the form and then reload the form the list loads fast again. I am loading about 1400 records with 4 columns.
Why is my listview control loading so slow? Is there anything I can do to speed this up without unloading the form and then reloading it. I am using VB 6 with Microsoft Windows common Controls 6.0 (SP4).
I am using visual basic 6.0
When the form is first loaded the list loads in about 3 seconds and when I try to reload it takes about 20 seconds.
ListView Control
I placed a ListView control on my form, and I have the mode set to List. However, the end of all of the data is cut off! I am having no luck in resizing the column so that I can see everything. The control is the whole width of the form, yet everything after about the first quarter is dot-dot-dotted.
Thanks in advance,
Jared
ListView Control
Hi,
Is there an obvious way to add a vertical scroll bar to the Listview control. Because at the moment my list will go to the bottom of the control then move horizontally to form another list and so on.
I just want 1 list which goes down only.
Any ideas?
Bug In ListView Control?
Hi everyone ...
I have a listView control set to 3-lvwReport. It is populated with many columns and rows. I have code in the click event. If Someone clicks on any row except the FIRST one, there is no problem, but if someone clicks the FIRST Row,First Column(like cell A1 in a spreadsheet) the code runs, but then the item remains selected in a mode that would allow the User to change that data. If this is a known bug, does anyone have a link to the fix ... if it is not a bug then how can I override this behavior?
Thanks,
Michael
ListView Control
Can anyone help me find some code where if you have a text box and you start typing into it your list view will scroll down to the letters your typing? In other words I've got a text box and a ListView populated with names from a database. When the user types in an M in the text box I want the ListView to scroll to the first M. Then if the user types an A I want it to scroll down to the first name that starts with MA and so on. I have a list box that will do it but the same code doesn't seem to work on the ListView control.
Thanks in advance.
Listview Control
Hi,
I have some items and subitems in my listview control. What my listview is used for is: when user doulbe clicks on a subitem(or on the row) it opens up IE separately and displays information about that particular subitem that was clicked.How i accompish this is i use the ItemClick event to set the value of the clicked subitem to a variable say matnum and then i use this matnum variable in my doubleclick event and pass it as a varibale in the URL string and open up the browser...
Okay..now my problem is when i sort the listview on a column, the view is changed and items get reordered, now when i double click on a subitem, the webbrowser should now open up with information of subitem i clicked but for some reason it does not behave so..it opens up the information for a different subitem which i guess was in this positon in the listview before i sorted. i guess my itemclick is not recognizing that i sorted the column. Any solutions for this? Thanks in advance
Surya
Listview Control Bug Please Help!
Hi there!
Sorry for the title, but I am kind of desperate...
I've just finished a database VB app for my client, and after testing everything in Windows 2000. I've found a major bug on the listview controls on WinXP.
When run on Win 2000, the user can swap columns, and change their widths, and changes are saved (.ini file). However, in WinXP, when the user clicks to swap the columns the application ends abruptly with a severe error.
If I disable the function (.columnswapping =false) the app works perfectly (since the event is never triggered to the control), but the client especially asked me for the swapping and user-customization of columns.
I am almost in front of the deadline date, with this problem as a surprise...
I searched the whole web and nothing....
I would greatly appreciate any suggestions.
Did anybody have did this problem?!
Where can I get a more recent version of the control?
Thanks everyone!
Cheers!
Rod
Listview Control.
Hi,
I have a listview control that is popluated with 200+ items. When a person selects, say for example item 195 which is at the very bottom of the listview (and you have to scroll down to get there), my program allows you to edit the entry (some code). When they have updated and I do a refresh routine I would like the listview pointer to be at the item they have just edited. So is there anyway to say to the listview control, be at x position on the listview, selected.
Many Thanks
Cliff
Is Listview The Control I Need For This?
I have an array of coordinate sets representing points on a chart,
X(I, J), Y(I,J)
where I is the set number, I = 1,...,NSets
and J is the point number, J = 1,...,NPoints(I)
My question is, is a Listview an adequate control for displaying the data such that one column holds the X(1,J) coordinates, next column Y(1,J), then X(2,J), then Y(2,J) and so on? The reason I ask is the number of points NPoints(I) is not necessarily the same for each set of coordinates, i.e. not all the columns have the same number of elements. If, for example, X(1,J),Y(1,J) run from 1 to 100 and X(2,J),Y(2,J) run from 1 to 120, do I have to add 20 extra blank ("") items on the first column? In general, do I have to pad with blanks all those subitems where NPoints(J) < Max( NPoints() ) ?
Whether or not it's worth the trouble, I'd like to know if there's a more adequate control (MSFlexgrid?) for this type of operation before I may run into any serious trouble.
ListView Control...
Hi,
I'm trying to use the listview control to display a list of items, as a list, but after 18 characters or so, it keeps going like this:
12345678910abc...
12345678910abc...
12345678910abc...
And wont display the full string, but just three trailing dots to indicate that there's more. Is there anyway of displaying the entire text in a row? Rather than all the rows being a fixed width?
I need to use a listview, rather than a listbox, as I intend in formatting the colour of texts etc which I understand isn't possible in a standard listbox.
Thanks
Snowblind
Listview Control
Hi there,
I am using a listview control and i have filled it with items including two sub items. (3 Coulmns). If you notice on a list box, when you select an item the focus bar extends right across the list box. how can i do this with the list view.
Regards
Jenova
|