-
October 19th, 2003, 07:29 AM
#1
VB6 - ListBox with CheckBox Style?
Hi
I use the ListBox with the CheckBox style in my form.
The problem is that if the user want to mark one item he need to double click on the item and not one click.
Any one ca tell me how to get it done with one click?
Thanks
-
October 19th, 2003, 12:24 PM
#2
try one of these 2:
Code:
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Item.Checked = Not Item.Checked
End Sub
Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
ListView1.HitTest(x, y).Checked = Not ListView1.HitTest(x, y).Checked
End Sub
-
October 21st, 2003, 02:53 AM
#3
Hi
This is .Net i ask about VB 6.
Thanks.
-
October 21st, 2003, 05:07 PM
#4
nope, this is vb6, not .NET.....
-
October 22nd, 2003, 12:32 AM
#5
OK
I cant find this events, but i see that you write ListView- i use ListBox.
The ListBox don't have the HitTest function and ItemClick event with the argument that you wrote.
-
October 22nd, 2003, 05:49 PM
#6
Many apologies - listbox, not listview!
I find the listbox control a pain in the a*se. See the following code, it should be sufficient...
Code:
Option Explicit
Private mblnLoading As Boolean
Private mblnBusy As Boolean
Private Sub Form_Load()
Dim X As Integer
mblnLoading = True
For X = 0 To 9
With List1
.AddItem Screen.Fonts(X)
.Selected(X) = True
End With
Next ' x
mblnLoading = False
End Sub
Private Sub List1_ItemCheck(Item As Integer)
If mblnLoading = False And mblnBusy = False Then
List1.Selected(Item) = Not List1.Selected(Item)
End If
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mblnBusy = True
List1.Selected(List1.ListIndex) = Not List1.Selected(List1.ListIndex)
mblnBusy = False
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|