Re: loose cursor on listbox
Are you trying to set it so that nothing can be selected from the ListBox?
Re: lose cursor on listbox
Quote:
Originally Posted by Hack
Are you trying to set it so that nothing can be selected from the ListBox?
yes.
But I don't want to use something like
Code:
List1.ListIndex <> -1 Then List1.ListIndex = -1
as the mouse still can click on the listbox and the item changes color that confuse the user (because I have a few other lists on the same form). Any ideas??
Re: loose cursor on listbox
I have one solution, but its way different and a bit more code. Basically it puts a clear picture box over a control so the user can see it perfectly as if the control was enabled but can't select anything or use the scroll bars.
Re: loose cursor on listbox
I don't have VB6 with me. This work for me with Form2 ListBox in VBA: user still can use scrollbar but cannot click on list items.
Try to see if it works with VB ListBox.
Code:
'-- In VB, "ByVal" may not present
Private Sub List1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
'-- 14 : this number is a bit smaller than the width of scrollbar that you can adjust
List1.Locked = (X < List1.Width - 14)
End Sub
Re: loose cursor on listbox
Quote:
Originally Posted by anhn
I don't have VB6 with me. This work for me with Form2 ListBox in VBA: user still can use scrollbar but cannot click on list items.
Try to see if it works with VB ListBox.
Code:
'-- In VB, "ByVal" may not present
Private Sub List1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
'-- 14 : this number is a bit smaller than the width of scrollbar that you can adjust
List1.Locked = (X < List1.Width - 14)
End Sub
".locked" is not available in VB6 :confused:
Re: loose cursor on listbox
Quote:
Originally Posted by Edgemeal
I have one solution, but its way different and a bit more code. Basically it puts a clear picture box over a control so the user can see it perfectly as if the control was enabled but can't select anything or use the scroll bars.
I tried, it's ok still seeing the listbox behind the picture box, but I need the scrallbar working. And the cursor still dispears if I hit on the listbox :(
Re: loose cursor on listbox
There's probably a lot easier way to do this if you subclassed the listbox, but heres one idea I came up without subclassing.
The sample project places a transparent Picture box over a ListBox to act as a .Locked method, but still allows the user to scroll the list box.
Edit: Updated code for Listbox Tabstop.
Edit: File removed - no reply (why do I even bother?)