From: mp on
Hi all,
I'm building a little form that can have multiple listboxes
listboxes show contents of a selected folder
like a (very rudimentary) group of "windows explorers" on one form
so i can conveniently look at different folders without having to stretch
and position multiple explorer windows.

since i group multiple listboxes they can be smaller than the filenames
shown.

how can i emulate the way windows expands partial text into a little tool
tip when you hover a mouse over?

thanks
mark


From: Mayayana on
The gist of it is fairly simple.
There's a sample tooltip class here:

http://btmtz.mvps.org/tooltip/

| Hi all,
| I'm building a little form that can have multiple listboxes
| listboxes show contents of a selected folder
| like a (very rudimentary) group of "windows explorers" on one form
| so i can conveniently look at different folders without having to stretch
| and position multiple explorer windows.
|
| since i group multiple listboxes they can be smaller than the filenames
| shown.
|
| how can i emulate the way windows expands partial text into a little tool
| tip when you hover a mouse over?
|
| thanks
| mark
|
|


From: mp on
Thanks Maya
:-)

"Mayayana" <mayayana(a)invalid.nospam> wrote in message
news:hur0s8$58l$1(a)news.eternal-september.org...
> The gist of it is fairly simple.
> There's a sample tooltip class here:
>
> http://btmtz.mvps.org/tooltip/
>
> | Hi all,
> | I'm building a little form that can have multiple listboxes
> | listboxes show contents of a selected folder
> | like a (very rudimentary) group of "windows explorers" on one form
> | so i can conveniently look at different folders without having to
> stretch
> | and position multiple explorer windows.
> |
> | since i group multiple listboxes they can be smaller than the filenames
> | shown.
> |
> | how can i emulate the way windows expands partial text into a little
> tool
> | tip when you hover a mouse over?
> |
> | thanks
> | mark
> |
> |
>
>


From: mp on
> | Hi all,
> | I'm building a little form that can have multiple listboxes
> | listboxes show contents of a selected folder
> | like a (very rudimentary) group of "windows explorers" on one form
> | so i can conveniently look at different folders without having to
> stretch
> | and position multiple explorer windows.
> |
> | since i group multiple listboxes they can be smaller than the filenames
> | shown.
> |
> | how can i emulate the way windows expands partial text into a little
> tool
> | tip when you hover a mouse over?
> |
> | thanks
> | mark
> |
> |
>
>

"Mayayana" <mayayana(a)invalid.nospam> wrote in message
news:hur0s8$58l$1(a)news.eternal-september.org...
> The gist of it is fairly simple.
> There's a sample tooltip class here:
>
> http://btmtz.mvps.org/tooltip/
>

Ok that's a helpful start...easy to add a tool tip to a control...very cool.
now i have to figure how to track where the mouse is in the listbox, over
what filename, in order to populate the tooltip with the full name of the
filename that is being truncated by the size of the listbox.
....hmmm... i hope i don't have to subclass to do this as i'm totally
ignorant of how to and dont' know if i have the mental resources to learn
:-)
i'm guessing somehow i can use mouse move, figure where the mouse is in the
list but how the heck to tell exactly what line it's on?

Private Sub List1_MouseMove(Index As Integer, Button As Integer, Shift As
Integer, X As Single, Y As Single)
The x and y values are always expressed in terms of the coordinate system
set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties of
the object.

....hmm... so how to figure which item it's over?

End Sub

any ideas?
thanks
mark


From: Bob Butler on

"mp" <nospam(a)thanks.com> wrote in message
news:huqv7a$ec6$1(a)news.eternal-september.org...
> Hi all,
> I'm building a little form that can have multiple listboxes
> listboxes show contents of a selected folder
> like a (very rudimentary) group of "windows explorers" on one form
> so i can conveniently look at different folders without having to stretch
> and position multiple explorer windows.
>
> since i group multiple listboxes they can be smaller than the filenames
> shown.
>
> how can i emulate the way windows expands partial text into a little tool
> tip when you hover a mouse over?

Private Type MakeDWord
X As Integer
Y As Integer
End Type
Private Const LB_ITEMFROMPOINT = &H1A9
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
ByRef lParam As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(ByRef dest As Any, ByRef src As Any, ByVal kBytes As Long)

Function ListBoxHitTest(ByVal LB As ListBox, _
ByVal X As Single, ByVal Y As Single) As Long
Dim uParam As MakeDWord
Dim lParam As Long
Dim r As Long
uParam.X = Me.ScaleX(X, Me.ScaleMode, vbPixels)
uParam.Y = Me.ScaleY(Y, Me.ScaleMode, vbPixels)
CopyMemory lParam, uParam.X, 4
r = SendMessage(LB.hwnd, LB_ITEMFROMPOINT, 0, ByVal lParam)
ListBoxHitTest = r
End Function

Private Sub Form_Load()
Dim X As Long
For X = 1 To 26
List1.AddItem String$(30, Chr$(X + 64))
Next
End Sub

Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Dim i As Long
i = ListBoxHitTest(List1, X, Y)
If i >= 0 And i < List1.ListCount Then
List1.ToolTipText = List1.List(i)
Else
List1.ToolTipText = ""
End If
End Sub