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!
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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 - Stop Icons Moving
Hi,
I'm using a listview control in the Icon mode, to display a control panel for my application. The only problem is that when a user clicks an icon, when you move the mouse it moves the icon as well.
Is there any way to stop the user moving the icon?
Moving A Listview Item And Its Subitems To A New Listview
Hey Guys,
Having a bit of trouble. I am attemping to move a selected item and its subitems from one listview to another. I have no problem getting the contents of the first column, but I can't seem to get the subitems over.
Example: I have this in the first listview:
Code:
|Item |Quanity|Price |PQ |
Bananas 2 $.50 $1.00
Then when I try to move that whole row to the other listview I can only seem to get this:
Code:
|Item |Quanity|Price |PQ |
Bananas
No subitems . Any links or help would be appreciated.
Regards,
Max_Power
Listview Item Moving
Hi there,
is it possible to move items in a Listview control(Up and down the list) and how, this one is baffling me
the pig...
Moving The Selected Item In Listview
****
I solved the problem, thanks to all for your attempt at helping.
Here is the code:
Set ListView.SelectedItem = ListView.ListItems(i)
****
I have a Listview populating from a database and sorts the data alphabetically.
Now when the user deletes an item from the database, it also refreshes the listview.
The question I have is, the listview always sets focus to the last item it added, however it does not add them alphabetically, so after there added and the listveiw sorts them, the item selected could be anywhere!? How can I have this list view set focus to the first entry? Or better yet one that I specify or has been saved (IE save the record ID when they exit the prog, so when they come back I can pull that and set focus to that item)??
Thanks for the help.
Bryan
[This message has been edited by Bryan (edited 01-12-2000).]
Stop The Dragging...?
Here's what I have:
- A label control array within a picturebox. The label control array
- can be dragged left and right from one end of the picturebox
- to the other. The problem is that the control array can also
- be dragged past either end of the picturebox, making the label
- control array not usable.
Here's what I need:
- To be able to have the label control array stop from being
- dragged. In other words, have a left and right limit as to how
- far the control array can be dragged.
The way I'm doing it now.....doesn't work.
Any ideas welcome...
Stop Form From Dragging Off-Screen
I've searched this quite a bit and keep coming up with the same results... all of which don't really solve the problem...
I have a form that I want users to drag, however, I do not want the form to cross the edges of the screen. That is, I do not want any part of the form to disappear outside the screen. The only code I've found close to this is one to snap the form to the edge of the screen (while still allowing it to be pushed outside the screen).
I've tried using the mouse position API for the form, but it doesn't capture the X and Y coordinates for when you're over the form's border. I understand this to only see the INSIDE of the form, and not the form's border included.
Thanks in advance!
Stop Title Bar Mouse Dragging
Hello Folks,
i am new to this forum but i have a problem which i have researched but failed.
I have disabled my applications titlebar,maximise button. But the title bar actually docks itself in a restored state and yet i wanted it maximised so that no one would drag it over the screen as this happens when its in a restored state.
How can i be able to disable the Mouse Click move titlebar(or application window) action.
Thanks in advance.
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
Menu Item Dragging
One facility that Windows provides with certain menus is the ability to drag and drop items in them to different positions so that the user can re-order them (see for instance the Favorites menu in Internet Explorer and the Programs menu in the Start menu). So what if you want to have this sort of facility in your VB application? Can it be done?
The answer is yes, although clearly it can't be done with native VB, and it does in fact require subclassing of two separate windows. The attached project provides a demonstration of how it can be done. It emulates the design used in Windows 98, which is to have a bar appear over the menu to show where the menu item being dragged will be dropped. I have not explored emulating the design used in Windows XP, which is to have a translucent copy of the menu item being dragged appear as a drag icon, but no doubt the technique to do this would be similar, if more advanced.
The stages to allowing menu item dragging and dropping are:
1. Subclass the form that contains the menus. You will need to be comfortable with the concept of subclassing in order to understand the project. If you're not, try this thread by John.
2. In the subclassing routine for the form (WindowProc of SubClassForm), set the menus to be ownerdrawn. Code for this is courtesy of Garrett Sever at EliteVB .
3. Obtain the hwnd of the menu window. This is NOT the same as the handle to the menu, which all APIs to do with menus seem to use. Instead it is the handle to a window that contains the menu. You could get this through looking for the WM_ENTERIDLE message in the form subclassing routine, which gives it to you, although I do it by waiting until the first item in the menu is drawn, and then finding it with FindWindow.
4. Subclass the menu window. This is the key to the whole thing. All of the following steps are carried out in the menu window subclassing routine (MWProc of SubClassMenuWindow). The form subclassing routine does not give you sufficient messages to provide for menu item dragging, so you have to do this.
5. When the left mouse button goes down on the menu (MWM_MOUSEDOWN, MWM_MOUSEDOWNWIN98 messages), record where it does.
6. If the mouse moves (MWM_MOUSEMOVE message) outside the drag rectangle without coming up, begin a drag operation. Get a device context for the menu window, and draw a bar onto that device context to show where the menu being dragged will be dropped if the user releases the left mouse button.
7. When the left mouse button comes up (MWM_MOUSEUP, MWM_MOUSEUPWIN98 messages), don't call the original window procedure. Instead, re-arrange the data which your menus represent, and cause the menu window to be refreshed by use of InvalidateRect. This allows the user to see the changes that he has made before the menu is dismissed.
And that's about it. It is complicated, and it is otherwise undocumented so far as I can see, but it does work. If you have any comments or find any bugs then please PM me.
Show Item Text When Dragging A Treeview Node
Does anybody know how when dragging a treeview node, to display the text property of the node as well as the DragIcon. I want to be able to replate the drag drop behaviour of Windows Explorer, i.e while you are dragging a folder, you can see the folder name in transparent text.
I have no problem setting the DragIcon property from an imageList I have associated with the treeview. For example in the DragOver event I am setting the DragIcon based on whether the mouse is over a valid drop point. E.g. .DragIcon = LoadResPicture("NoDrop", vbResCursor)
However it only shows the DragIcon and nothing else when dragging the node. Any help appreciated.
ListView DRAGGING
How can I select multiple items by clicking and then dragging over the amount of records that are there?
thanks...
Stop Txt Moving
can any1 tell me how u stop txt that is in side a pic box moving ever thing u click in the box
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 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.
Pic Box, Object To Stop Moving
what im trying to do is make it so that i have one bit picture box and a pong design interface inside it(this is a final assignment im making a variation of pong) anywho what im trying to do(and tryed everything i've thought of) is to get it so that when you drag the padel down it cannot pass the line at the top or the bottom, and both these lines are drawn, not made at runtime. thanks for help
also after you hit the line you cannot go down or up further then the line, and you can continue moving inside the two lines
Trying To Stop A Form Moving
hi, i am making a program that has docking forms onto the main mdi form. I am trying to make it so that the forms can be docked and undocked. I have so far made a timer that keeps a form in its position all the time but when the user tries to drag the form it flashes and such and then returns to the position wheras i don't want it to move at all, is there any way i can subclass it to stop it moving?
Click Item In Listview Then Show That Item In Combo As Index = 0
Hi guys,
I have a listview (lvwUserPunchedOut) that is populated with records in a database (persons first name in one column and last name in the second column), what I am looking to do is if I select a persons name by clicking on it in the listview on frmMain, and then bring up frmSearchCriteria, i would like to show that selected name in the combobox as default (cboEmployee.ListIndex = 0) on frmSearchCriteria (the combobox is sorted = True and is also populated with first name and last name of the person)
How would this be done? Hope I make sense. Thanks in advance.
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
How Do I Make A Shape Stop Moving?
I have a shape(Shape1) that you can move with the arrow keys....how do i make the Shape1 cease to move when a certain event happens, even though the arrow keys are still pressed?
thanks for any help!
Stop Maximized Form From Moving
I am using a picturebox as a container to act as a mdiparent because only 1 midparent is allowed when I need 2. When I maximize a "child" form, the title bar is still visible which enable the user to move the max form. I get an error when I set moveable=false during runtime. Is there any way to stop the maxed form from moving? Thanks.
How Do I Stop Flickering In Moving Graphics?
I haven't dealt with graphics in vb before, but I know of a common graphics method to reduce/eliminate flicker in animations called double-buffering.
The flicker is caused from clearing the old frame before drawing the new one. To counter this problem you actually would have 2 picture boxes (or whatever you're using) the first one is the visible one that will display the animation. On the second buffer, you do the calculations for the next frame and place all the objects there, then once the frame is ready for display you change the image on the visible buffer to that of the second buffer.
Since I haven't done this in vb before I'm not to helpful in the code department, but hopefully you'll find this method usefull.
Trying To Stop Moving Past Last Record
I am writing a database with a number of tables with forms atttached to each table. I have placed navigation buttons on each form to move to first, last, next, previous. I have set up the code associated with the buttons as "public sub" so it is available for each form to use.
This was working OK except that when I used the NEXT button at the last record it would open a new blank record & keep opening a new blnak record on each click.
To over overcome this I put in an If statement to check if it had moved to a new record. To do this I used the following:
If Me!NewRecord Then ..... etc
Now I get an error "Invalid use of Me key word" I suspect it is because I am using ME in a public sub
How do I overcome the problem of moving passed the last record and still have the coding available to all forms?
The Code is below.
Thnaks for any help.
Public Sub Next_Record_Click()
On Error GoTo Err_Next_Record_Click
DoCmd.GoToRecord , , acNext
If Me!NewRecord Then
' If new record move back to previous
DoCmd.GoToRecord , , acNext
' Send message
MsgBox "This is the last record", , "No More Records"
End If
Exit_Next_Record_Click:
Exit Sub
Err_Next_Record_Click:
MsgBox Err.Description
Resume Exit_Next_Record_Click
End Sub
Stop User Moving The Chart Around In MsChart
VB6 SP6
I am using MsChart. I need to allow selections but when this is set to True users can click on the chart and move the plot area around the unplotted area.
Anybody know a way to avoid this
Thanks
Stop A Moving Image Drawing Over Other Lines...
I have the following code which moves a little image control across the form, but what happens when it moves across slowly is it sort of half draws over lines that I have on the form....how can i get it so that it doesnt draw over the other lines and leaves them intact....so that it doesnt leave this kind of trail.....
VB Code:
Private Sub Timer1_Timer()If Image2.Left < 9240 Then Image2.Left = Image2.Left + 1'only move the picture one space over if it isnt alreadt at the desired locationEnd IfEnd Sub
How To Stop Cursor Keys Moving Focus ?
I am writing a program where an object can be moved round the screen. I first did this using command buttons and then wanted to add the option of using the keyboard cursor keys.
KeyAscii and/or KeyCode worked for most keys but not the cursor keys which didn't seem to generate any events. I got something working using an API call (GetAsyncKeyState).
The bit which still bugs me is that when the user presses the cursor keys, as well as moving the on-screen object, it also moves focus round the various command buttons.
Can anyone suggest how to stop this happening ?
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.
Making A Label Stop Moving When It Hits A Certain Point[solved]
I have a long Label, it shows text, I want it to scroll slowly, but how do I make it stop at a certain point, If I do
VB Code:
Private Sub tmrAbout2_Timer() DoEvents LblAbout.Top = LblAbout.Top - 10 DoEventsIf LblAbout.Top <= 0 Then tmrAbout2.Enabled = FalseEnd Sub
Then it stops when the top of the label hits the top of the form/frame, I want it to scroll through the top of the frame, Its fine if I dont put an If then but it keeps going forever.
Moving To The Next Item In A Pivotfield
I have some code which runs in this For loop.
Code:
For Each PivotItem In ActiveSheet.PivotTables("PivotTable1").PivotFields("Questions").PivotItems
Sheets("Pivot Table").Select
Range("A4").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Chart Data").Select
ActiveCell.Select
ActiveSheet.Paste
Sheets("Pivot Table").Select
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Chart Data").Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(3, 0).Select
Next
The item "Questions" is in the page field at the top.
I'd like the code to move to the next item in the page field, and perform the code.
Any idea how it's done?
Moving Item From One Listbox To Another
Hey all
I am trying to move an item from one listbox to another. The first listbox has items where the RowSourceType = "Field List" and the second one is value list. This is my code:
Private Sub DisplayAllFields_DblClick(Cancel As Integer)
If ListOfFieldsSelected.RowSource = (List0.Value & "." & DisplayAllFields.Value) Then
MsgBox ("You cannot select a field more than once. Please select another field")
Else
ListOfFieldsSelected.AddItem (List0.Value & "." & DisplayAllFields.Value)
End If
End Sub
When I double click the same value in the first list again, it brings up the msgbox once but it doesn't do that once it has added another field to ListOfFieldsSelected. I would use the RemoveItem method so user can't click the field again but DisplayAllFields is set to Field List so it can't remove item unless set to "Value list". Any suggestions on this?
Any help will be greatly appreciated.
Many thanks
Rupa
ListBox, Moving From First Item To Second And So On
Hey, im working on a media player, the media player works great but the playlist is screwey! Im having troubble with this:
You select an item for play - 100% ok
it plays it - 100% ok
it then goes to the next item on the list - BUGGY!
it wont move to the next item and when it does, it wont update the selected item eg, it will play the next item then when thats done it will play the one before that not the next on (constant loop between two files). Please help
Moving A Item In A List Box Up Or Down
I have two buttons on a form and I want the be able to click the up button then move the selected item up or click the down button and have the item go down.
Any Ideas?
Moving Item Between List Boxes
I have a command button with the Caption ">". When clicked I want the selection the user has made in ListBox1 to be moved to ListBox2.
Anyone ever do something like this before?
thx..
When Moving Item Down In The Listbox The Text Disappears
Okay dont know why but the text is dissapearing when an item is moved down the list box.
Image1 displays before the move down
Image2 displays after the move down
Code is also attached. I am very confused I have been through this code througherly and I am sure there is not an error in the code.
Code:
' check: only proceed if there is a selected item
' check: last item can't be moved down
' save items text and items indexvalue
' remove item
' place item back on new position
' if you keep that item selected
' you can keep moving it by pressing cmdDown
' for arLoopCount adds the new playlist entrys from
' lstPlayList.
' list1 refreshes
' lstPlayList refreshes
Dim tempStr As String
Dim iIndex As Integer
Dim arLoopCount As Integer
List1.Clear ' Debugging orriented object to display the contents of arFilePlayList Array
If lstPlayList.SelCount = 1 Then
If lstPlayList.ListCount - 1 = lstPlayList.ListIndex Then
Exit Sub
Else
tempStr = lstPlayList.List(List1.ListIndex)
iIndex = lstPlayList.ListIndex
lstPlayList.RemoveItem lstPlayList.ListIndex
lstPlayList.AddItem tempStr, iIndex + 1
lstPlayList.Selected(iIndex + 1) = True
End If
End If
For arLoopCount = 0 To lstPlayList.ListCount
arFilePlayList(arLoopCount) = lstPlayList.List(arLoopCount)
List1.AddItem arFilePlayList(arLoopCount)
Next arLoopCount
List1.Refresh
lstPlayList.Refresh
Questions: BitBit Moving, Walkmasks And Item Pickups.
Ok, so far have i quickly created a small program where a picture(the guy you control) moves instantly to the location of your click. Theres 3 things i must now:
1. How can i make my guy move slowly to the targeted location? not instantly.
2.How can i create walkmasks? Forexample if i create a tree, and i dont want my guy to walk right through the tree but around it.
3.How can i make my character pick up items? Forexample how can i make my guy get 10 score-points when he moves over an item, which in reality is a picture.
Edit*
I use BitBit.
This is not going to be a real game, iam just testing things out before i start creating a game.
Nothing is animated.
Stop Listview Selection
I am trying to stop the first row in a listview being selected when the form is first loaded.
I have tried using the
Code:
Listview1.SelectedItem = Nothing
in the Form_Activate and this doesn't work.
There is no other control on the form to set the focus to.
Any ideas or workarounds?
|