|
-
Jul 27th, 2005, 09:24 AM
#1
Thread Starter
Fanatic Member
Tricky little problem. I'm sure the solution is easy though
On my form there is a listbox full of names. This listbox is setup for OLE drag & drop so the user can drag names from this list.
This morning, I added a feature so that when a persons name is hilighted in the list, the "tooltiptext" pops up with additional information on that person.
The problem is that it doesn't look so good because you need to click a name in the list to make the tooltip show up. Doing so changes the mouseicon to the circle with the bar through it because it thinks your starting OLE drag drop.
I almost need some code that says if the user left-clicks and let's go, display the tool tip text...if they left click and hold, then do OLE drag drop.
I hope that makes sense.
-
Jul 27th, 2005, 10:17 AM
#2
Thread Starter
Fanatic Member
Re: Tricky little problem. I'm sure the solution is easy though
-
Jul 27th, 2005, 11:02 AM
#3
Fanatic Member
Re: Tricky little problem. I'm sure the solution is easy though
How about a "on hover" kind of thing? This code works with listviews - just, in the MouseMove event, change all instances of "listview" to whatever the name of your listview is.
VB Code:
Private Type POINTAPI
x As Long
Y As Long
End Type
Private Type LVHITTESTINFO
pt As POINTAPI
flags As Long
iItem As Long
iSubItem As Long
End Type
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wparam As Long, _
lParam As Any) As Long
Private Sub listview_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim lvhti As LVHITTESTINFO
Dim lItemIndex As Long
lvhti.pt.x = x / Screen.TwipsPerPixelX
lvhti.pt.Y = Y / Screen.TwipsPerPixelY
lItemIndex = SendMessage(listview.hwnd, LVM_HITTEST, 0, lvhti) + 1
If (lItemIndex >= 1) And (lItemIndex <= listview.ListItems.Count) Then
listview.ToolTipText = "whatever you want to tip to be"
Else
listview.ToolTipText = ""
End If
End Sub
-
Jul 27th, 2005, 11:32 AM
#4
Re: Tricky little problem. I'm sure the solution is easy though
 Originally Posted by The_Grudge
This morning, I added a feature so that when a persons name is hilighted in the list, the "tooltiptext" pops up with additional information on that person.
My question is where is this additional information coming from? If you have to query a database everytime someone selects something (or even worse, as the mouse simply moves over the item), then you are running the risk of an awful lot of overhead on your database and network connections.
-
Jul 27th, 2005, 11:44 AM
#5
Addicted Member
Re: Tricky little problem. I'm sure the solution is easy though
just a quick note, would the mouse up event not work for displaying the tooltiptext??
-
Jul 27th, 2005, 12:24 PM
#6
Re: Tricky little problem. I'm sure the solution is easy though
 Originally Posted by makster246
just a quick note, would the mouse up event not work for displaying the tooltiptext??
No. That would still require a click. He's trying to avoid having to do that.
Tg
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
|