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,
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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?
Problem With User Dragging A Label
In my current Project I set it up so that the user may Drag this label that is inside of a PictureBox. But when the user stops dragging the Label Dissapears. I also had this exact same problem with a Command Button, but the problem did not occur with a PictureBox. Heres the code i'm using to have it dropped:
Code:
X = X - Xy
Y = Y - Yx
Source.Left = X
Source.Top = Y
this is on Picture1_DragDrop
Xy is the X of where the user holds down the mouse button, on the Label. Yx is the Y of where the user holds down the mouse button. Thanks in advance for your help.
ListView DRAGGING
How can I select multiple items by clicking and then dragging over the amount of records that are there?
thanks...
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?
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 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
Positioning Multiple Stacked Forms Without User Dragging/Resizing
Need some ideas/code on how to position (without user dragging/resizing):
1. Stacking of multiple forms when a new one is added -- All currently active forms will have to be compressed and
top/height adjusted accordingly.
2. Repositioning of multiple stacked forms when one is deleted so the deleted area is filled by the others.
3. Searching the registry or DB to adjust left/top/width/height
for the now (those that still visible) active forms.
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.
Disabling User Zoom
I have a Worksheet that automatically sizes itself to display a set of controls. The number and position of these controls varies according to the users access privileges and according to other criteria. I have turned off the scrollbars and split and frozen the screen so that the important area is always displayed. Whenever the layout of this pages changes, the window is automatically zoomed to the correct size, so that the controls are all visible (hopefully) on any machine.
This is the master control sheet for linking to all of the other sheets, opening user-forms for data input, etc. Users are unable to view any other sheet except through this one and unable to enter data directly into any sheet without it being filtered and validated through user-forms.
All of this works fine except for one small flaw. You can still zoom the sheet using the mouse wheel with Ctrl. I can't find any reference to disabling this anywhere. It's more annoying than a serious problem but I'm a bit of a perfectionist at times.
I would like the mousewheel active for scrolling listboxes etc., so I don't want it disabling totally, I just would like to disable zooming.
Hope someone can help.
Thanks in advance,
XC
Prevent User Disabling Macro's??
Hello,
i'v made a maximised userform that opens automatically on opening the excel file. it works great
this userforms takes the user through some steps to calculate some test-scores.
Problem : if the user disables the macro's, the file still opens AND it shows the underlying worksheets.
I DON'T WANT THAT TO HAPPEN!!
question : Can I prevent the user from opening my workbook if he/she doens't enable the macro's
Maybe even pop up a warning that they should enable macro's (although if they disable macro's it will be difficult to pop up anything at all)
Disabling User From Access A File?
Hello friends. I have a file which is required to be read by the program. However I do not want the user to be able to see the file or at least prevent the user from changing it's contents in the program directory, is there anyway to do this?
Disabling Macro Depending On The User
Hi,
Could someone tell me how I could disable a excel macro depending ont he user, maybe 2 users that the macro should not work for. Could it take the logged in user name and do a comparison? I just havent a clue....
Prevent User From Disabling Macros
I have some code that I have written to password protect a workbook.
The problem I am experiencing is that if the user disables macros, then
it does not work. Is there a way to prevent the user from disabling
macros. Thanks for your kind help.
Thanks,
MT.
Listview Disabling
When you:
Listview1.Enabled = False
it will obviously disable the 'Listview1' preventing anymore selecting e.t.c. of it's contents (report view).
But this causes the listview display to be 'greyed' out.
Is it possible to still disable the listview but NOT have it greyed out, so it's still white ?
TIA
Disabling A Control Based On The User Group
Hi all
I would like to be able to disable buttons depending on the user group when a form is loaded..
Say if the button is called buttonA
and i want to be able to disable these buttons if the usergroup = "Viewers"
I don't know the correct syntax please help..
Stop User Changing Tickbox Without Disabling It.
hi,
I don't want the user to be able to change the tickbox but I don't want to disable it as it looks wrong (greyed out). I want to use the tickbox to show the user that data exists for that section (they then can click a button and go to the data on a second screen)
how do I do this....I really just want to show the user that data exists.
thanks
Anne
Disabling Rows In A Listview
Hi
Is there is a way that I can disable rows in a Listview?.
I want to do this:
For example:
I add 5 items to a listview then I have a buttom "cmdPrint" to print those Items, if I click "Print", I want to disable the 5 item and the same time i want to add new items and if I click print the new Item need to be disable too.
This is to prevent that if I print an "Order" the users can modified the items.
I'll appreciate you help,
Elvis Cabral
ListView Disabling Subclass?
I'm currently trying to get the mouse wheel working with a listview when the scrollbars are hidden(I've made my own custom scrollbar).
I've tried many many subclassing methods that all work fine, except when you select an item in the listview. Then it simply refuses to work.
I've enclosed an example project which should help explain things. If anyone knows of a way to solve this or of another way to go about getting the mouse wheel to work with ListView(when scrollbars are hidden) it would be much appreciated.
ListView Disabling MouseWheel Subclass?
I'm currently trying to get the mouse wheel working with a listview when the scrollbars are hidden(I've made my own custom scrollbar).
I've tried many many subclassing methods that all work fine, except when you select an item in the listview. Then it simply refuses to work.
I've enclosed an example project which should help explain things. If anyone knows of a way to solve this or of another way to go about getting the mouse wheel to work with ListView(when scrollbars are hidden) it would be much appreciated.
Spent far too long trying to get this to work.
Disabling Listview Column Re-sizing
How can I disable column re-sizing in a listview. ie. when you click on the separator between columns and drag it to shorten or widen column widths. I don't see any functions in the listview control to either disable this or events to know when it is happening. I'm assuming an API subclassing thing is required...Any ideas?
Thanks
Disabling Automatic Listview Find
I've just finished writing a routine to search for a row in my listview based on the character that the user types over the given column. I identify the column the mouse is over (MouseMove) and trap the character typed in (KeyPress) and then in a loop I compare the letter typed with the fist character of the subitem (corresponding to the column the mouse is over) in all listitems. If a match is found, the listitem is selected and I ensure it's visible. My problem is that the built-in feature that searches the Listview1.ListItems(x).Text for the typed character, does its own search after mine. The result is that it then positions itself to the first occurence of the character in Listview1.ListItems(x).Text, immediately after the occurence in the other column that I was searching on.
Listview columns and data:
Component ID_ CAS Number
29___________ 100-06-1
244___________ 112-30-1
250___________ 112-53-8
446___________ 120-14-9
188___________ 121-33-5
If the user types 1 over the CAS Number column it positions to Component ID 188. I've tested this with various numbers typed in and it consistently behaves this way. Typing letters in for others columns doesn't have this problem, presumably since the auto search cannot find an alphabetic value in the Component ID column.
It seems that the only way to prevent this is to disable that automatic feature. Anyone know how? Any other ideas?
ListView - Disabling A Single Item
I using the ListView control with checkboxes and two subitems for each item in my program to display a list of applications. I want to display a list of all our current applications in the control, but I only want user to be able to select certain ones (depending on whether he has permissions or not)
Is there a way to disable a single item? Or when the user click on a checkbox for an item I don't what him to select, is there a way to just uncheck the box? I can't find out what the event is when you click on the checkbox.
Thanks for the help,
Jacob
jfunderb@rocketmail.com
VBA - Excel - Disabling Prompt To Save When User Clicks X (close)
Hello from a wind swept Isle of Man,
I am building a spreadsheet which I don't want the user to save with the name it had when it was open.
A quick (but inappropriate here) answer is to make it a .XLT file so that it works as a template. However I don't want to do that as I need it to be an .XLS so that if more than one user opens it at once, I can test the read-only property for user No 2 and kick him out. The spreadsheet can only be used by one person at once.
So, back to my question: if the user decides to save the spreadsheet, how can I force the user to save using a new name?
Thanks and regards
Francois
Disabling Subform Without Disabling The Scrollers
Hi Eveyone,
I have a subform and i want to disable it so user can't change the values in it. However, I want the user to be able to scroll it since the subform is in Datasheet view and it has quite a lot of fields.
I tried locking it, but the user is still able to see the other options in the combo box and i don't want that to happen.
Is it possible to just disable the data entering or changing in a form directly (i want to be able to change the data through my main form)?
Disabling A TextBox Without Disabling Its Scrollbars.
Hello,
I have a very simple objective. Disallowing the user input into a TextBox. Its a multi-line one who's text I fill from code. If I set .Enabled to False, that also disables the scrollbars, which is something I don't want. What to do?
Thanks in advance for your help,
Nas.
Find out what you like doing best and get someone to pay you for doing it.
ListView Control - Allow User Editing !??
Hi i have a Listview in one of my projects (in Report view) that i need the user to be able to click on any cell and modify the value.
My Listview has 4 columns which i populate in the following manner !!
VB Code:
Public Sub ListSetup(lst As ListView,n As Integer) 'Litems Array is Created and populated elsewhere ! Dim lvi As Object Set lvi = lst.ListItems.Add(, "A" & CStr(n), Litems(0)) lvi.SubItems(1) = Litems(1) lvi.SubItems(2) = Litems(2) lvi.SubItems(3) = Litems(3) lvi.SubItems(4) = Litems(4) End Sub
My problem is that no matter what option i try i can't seem to make all the Cell's editable when you click into them. Only the rows in the first column are editable !!!!
Also only the rows in the FIRST column will highlight when you click on them.
So, does anyone know of a way to change this behaviour so that the user can edit any cell in the Listview by double clicking on it, as changing the LabelEdit property only seems to work for first Column !
Thanks
Rich
Hide 2 Fields In Listview From User
I would like to know if there is a way to only display one item is a listview, and make the other 2 items invisible to the user. The other 2 items are needed to create a query string. But I want the user to see the one word description of the field. The fieldname, rep_caption, and fieldid are displayed. I would like the user to only see the rep_caption.
Here is the code for the operation:
'----fill in the field list
With lvwGuardian
.ListItems.Clear
.ColumnHeaders.Clear
.View = lvwReport
.ColumnHeaders.Add , , "Field", 0
.ColumnHeaders.Add , , "Field", 1500
.ColumnHeaders.Add , , "Order", 500
.ColumnHeaders.Add , , "ID", 0
.MultiSelect = False
.HideSelection = False
.AllowColumnReorder = False
.FullRowSelect = True
.LabelEdit = lvwManual
.DragMode = vbManual
rsTemp.Open "SELECT fieldid, fieldname, rep_caption, fieldorder, allowgroup, allowsort FROM rep_fields where alias like 'guardian%' or alias like 'x%' order by fieldorder", gcnData, adOpenForwardOnly, adLockReadOnly
Do While Not rsTemp.EOF
Set itm = .ListItems.Add(, , Trim(rsTemp.Fields("fieldname").value))
itm.ListSubItems.Add , , Trim(rsTemp.Fields("rep_caption").value & "")
itm.ListSubItems.Add , , intCount
itm.ListSubItems.Add , , rsTemp.Fields("fieldid").value
intCount = intCount + 1
'----Store the fields that can't be grouped by
If Trim(rsTemp.Fields("allowgroup").value) = "N" Then
ReDim Preserve mstrNoGroupBy(intGroup)
mstrNoGroupBy(intGroup) = Trim(rsTemp.Fields("fieldname").value)
intGroup = intGroup + 1
End If
'----Store the fields that can't be sorted by
If Trim(rsTemp.Fields("allowsort").value) = "N" Then
ReDim Preserve mstrNoSortBy(intSort)
mstrNoSortBy(intSort) = Trim(rsTemp.Fields("fieldname").value)
intSort = intSort + 1
End If
rsTemp.MoveNext
Loop
End With
Detect If User Scrolls ListView
how do i detect when user clicks the scrollbar on ListView object and starts to scroll it up or down or whatever while holding the mouse button.
mouseDown() doesn't detect mouse events on the ListView's scroll bars.
please help!
Hide 2 Fields In Listview Box From User
I would like to know if there is a way to only display one item is a listview box, and make the other 2 items invisible to the user. The other 2 items are needed to create a query string. But I want the user to see the one word description of the field. The fieldname, rep_caption, and fieldid are displayed. I would like the user to only see the rep_caption.
Here is the code for the operation:
'----fill in the field list
With lvwGuardian
.ListItems.Clear
.ColumnHeaders.Clear
.View = lvwReport
.ColumnHeaders.Add , , "Field", 0
.ColumnHeaders.Add , , "Field", 1500
.ColumnHeaders.Add , , "Order", 500
.ColumnHeaders.Add , , "ID", 0
.MultiSelect = False
.HideSelection = False
.AllowColumnReorder = False
.FullRowSelect = True
.LabelEdit = lvwManual
.DragMode = vbManual
rsTemp.Open "SELECT fieldid, fieldname, rep_caption, fieldorder, allowgroup, allowsort FROM rep_fields where alias like 'guardian%' or alias like 'x%' order by fieldorder", gcnData, adOpenForwardOnly, adLockReadOnly
Do While Not rsTemp.EOF
Set itm = .ListItems.Add(, , Trim(rsTemp.Fields("fieldname").value))
itm.ListSubItems.Add , , Trim(rsTemp.Fields("rep_caption").value & "")
itm.ListSubItems.Add , , intCount
itm.ListSubItems.Add , , rsTemp.Fields("fieldid").value
intCount = intCount + 1
'----Store the fields that can't be grouped by
If Trim(rsTemp.Fields("allowgroup").value) = "N" Then
ReDim Preserve mstrNoGroupBy(intGroup)
mstrNoGroupBy(intGroup) = Trim(rsTemp.Fields("fieldname").value)
intGroup = intGroup + 1
End If
'----Store the fields that can't be sorted by
If Trim(rsTemp.Fields("allowsort").value) = "N" Then
ReDim Preserve mstrNoSortBy(intSort)
mstrNoSortBy(intSort) = Trim(rsTemp.Fields("fieldname").value)
intSort = intSort + 1
End If
rsTemp.MoveNext
Loop
End With
ListView Or MSFlexGrid - User Edit Cells
I have a list view (But I now understand that I may need to use a MSFlexGrid) that is populated with data from a database and I am trying to allow a column to be left blank for user input. Please see the following screen shot.
The columns that are populated from the db must remain unchanged.
I am sure there is a simple solution but this one is realy fighting me.
Thank you in advance.
Matt
Get Indexes Of Listview Items Visible To User...
ahh ok i get it now...
however, upon putting in all my code to do when i reparse the listview, this still is going to take longer than desired.. in fact much longer.... i think i will go to the update the visible records idea...
but im not sure how to go about subclassing to have the listview_scroll event... i've never had to do any subclassing, and am having some trouble finding proper examples.... could u help me out a bit crptcblade?
i'll keep looking in the meanwhile
|