|
-
Feb 22nd, 2004, 01:03 AM
#1
Thread Starter
Hyperactive Member
right click a listbox array?
Code:
Private Sub List1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim P As Long, XPosition As Long, YPosition As Long
XPosition = CLng(x / Screen.TwipsPerPixelX)
YPosition = CLng(y / Screen.TwipsPerPixelY)
P = SendMessage(List1.hWnd, LB_ITEMFROMPOINT, 0, ByVal ((YPosition * 65536) + XPosition))
If P < List1.ListCount And Button = vbRightButton Then
List1.ListIndex = P
PopupMenu dsfdsf
End If
End Sub
that code will let me right click a listbox, but how would i do it with an array? can i load that code into a listbox array?
-
Feb 22nd, 2004, 01:26 AM
#2
The index property holds the index of the listbox clicked. Does that help? Cut the code out of the sub, delete the sub and create it again to add the array parts to it.
Simply use gotos or something to reference which listbox called the sub and then execute the code.
I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)
-
Feb 22nd, 2004, 02:32 AM
#3
Thread Starter
Hyperactive Member
im sorry, but i dont know what your talking about. i think you are saying to load the array by hand instead of using the code to load it(i dont want to do this if this is what your saying)? and double click the listbox array and add that code? can you give me an example?
-
Feb 22nd, 2004, 02:38 AM
#4
Better still, add to the argument list and do what i said, forget about the delete the sub stuff.
I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)
-
Feb 22nd, 2004, 02:44 AM
#5
Thread Starter
Hyperactive Member
-
Feb 22nd, 2004, 02:49 AM
#6
Change this:
VB Code:
...List1_MouseUp(Button as Integer...
to this:
VB Code:
...List1_MouseUp(Index as Integer, Button as Integer...
I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)
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
|