Discussion:
ToolTip in vb6 ListView?
(too old to reply)
Brian McCullough
2004-09-24 19:55:36 UTC
Permalink
Hello all,

Is there a way to display a ToolTip in a VB6 ListView when the mouse is idle
for a second or two?

I would like similar functionality as the Windows Explorer panel which
displays information about an item if the mouse stays over it for a second
or so (i.e. the file attributes).

Thanks in advance!

Brian
Ken Halter
2004-09-24 20:04:12 UTC
Permalink
Post by Brian McCullough
Hello all,
Is there a way to display a ToolTip in a VB6 ListView when the mouse is idle
for a second or two?
I would like similar functionality as the Windows Explorer panel which
displays information about an item if the mouse stays over it for a second
or so (i.e. the file attributes).
Thanks in advance!
Brian
Each ListItem/ListSubItem has a ToolTipText property...
'==============
Private Sub Form_Load()
Dim i As Integer
With ListView1
.View = lvwReport
.ColumnHeaders.Add , , "Item"
.ColumnHeaders.Add , , "SubItem"
For i = 1 To 10
With .ListItems.Add
.Text = "Item " & i
.ToolTipText = "Here's the tooltip for " & .Text
With .ListSubItems.Add
.Text = "SubItem " & i
.ToolTipText = "Here's the tooltip for " & .Text
End With
End With
Next
End With
End Sub
'==============
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
Brian McCullough
2004-09-24 20:17:18 UTC
Permalink
Thanks Ken,

For some reason, I do not have the ToolTipText available to me!?!?!?

Do While Not rs.EOF
With lvClientNotes.ListItems.Add(,
CStr(rs.Fields.Item("NoteId").Value) & "K", rs.Fields.Item("Type").Value &
"")
.SubItems(1) =
RTrim(rs.Fields.Item("LastModUser").Value) & ""
.SubItems(2) =
Format(rs.Fields.Item("LastModDate").Value, "mm/dd/yyyy")
.SubItems(3) = Replace(rs.Fields.Item("Note").Value,
vbCrLf, " ") & ""
.ToolTipText = rs.Fields.Item("Note").Value & ""
'<----does not work!
End With

rs.MoveNext
Loop
rs.Close


Also, is there a way to allow the columns to display "thicker" than 1 row?

Thanks again!

Brian
Post by Ken Halter
Post by Brian McCullough
Hello all,
Is there a way to display a ToolTip in a VB6 ListView when the mouse is
idle for a second or two?
I would like similar functionality as the Windows Explorer panel which
displays information about an item if the mouse stays over it for a
second or so (i.e. the file attributes).
Thanks in advance!
Brian
Each ListItem/ListSubItem has a ToolTipText property...
'==============
Private Sub Form_Load()
Dim i As Integer
With ListView1
.View = lvwReport
.ColumnHeaders.Add , , "Item"
.ColumnHeaders.Add , , "SubItem"
For i = 1 To 10
With .ListItems.Add
.Text = "Item " & i
.ToolTipText = "Here's the tooltip for " & .Text
With .ListSubItems.Add
.Text = "SubItem " & i
.ToolTipText = "Here's the tooltip for " & .Text
End With
End With
Next
End With
End Sub
'==============
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
Bryan Dickerson
2004-09-24 20:24:00 UTC
Permalink
Read thru his code again. He doesn't use the .Subitems property, he uses
the .ListSubItems collection for each Item. Each item under that has a
.Text and a .ToolTip property.
Post by Brian McCullough
Thanks Ken,
For some reason, I do not have the ToolTipText available to me!?!?!?
Do While Not rs.EOF
With lvClientNotes.ListItems.Add(,
CStr(rs.Fields.Item("NoteId").Value) & "K", rs.Fields.Item("Type").Value &
"")
.SubItems(1) =
RTrim(rs.Fields.Item("LastModUser").Value) & ""
.SubItems(2) =
Format(rs.Fields.Item("LastModDate").Value, "mm/dd/yyyy")
.SubItems(3) = Replace(rs.Fields.Item("Note").Value,
vbCrLf, " ") & ""
.ToolTipText = rs.Fields.Item("Note").Value & ""
'<----does not work!
End With
rs.MoveNext
Loop
rs.Close
Also, is there a way to allow the columns to display "thicker" than 1 row?
Thanks again!
Brian
Post by Ken Halter
Post by Brian McCullough
Hello all,
Is there a way to display a ToolTip in a VB6 ListView when the mouse is
idle for a second or two?
I would like similar functionality as the Windows Explorer panel which
displays information about an item if the mouse stays over it for a
second or so (i.e. the file attributes).
Thanks in advance!
Brian
Each ListItem/ListSubItem has a ToolTipText property...
'==============
Private Sub Form_Load()
Dim i As Integer
With ListView1
.View = lvwReport
.ColumnHeaders.Add , , "Item"
.ColumnHeaders.Add , , "SubItem"
For i = 1 To 10
With .ListItems.Add
.Text = "Item " & i
.ToolTipText = "Here's the tooltip for " & .Text
With .ListSubItems.Add
.Text = "SubItem " & i
.ToolTipText = "Here's the tooltip for " & .Text
End With
End With
Next
End With
End Sub
'==============
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
Brian McCullough
2004-09-24 20:50:18 UTC
Permalink
I was using an older version of the ListView control.
Post by Bryan Dickerson
Read thru his code again. He doesn't use the .Subitems property, he uses
the .ListSubItems collection for each Item. Each item under that has a
.Text and a .ToolTip property.
Post by Brian McCullough
Thanks Ken,
For some reason, I do not have the ToolTipText available to me!?!?!?
Do While Not rs.EOF
With lvClientNotes.ListItems.Add(,
CStr(rs.Fields.Item("NoteId").Value) & "K", rs.Fields.Item("Type").Value &
"")
.SubItems(1) =
RTrim(rs.Fields.Item("LastModUser").Value) & ""
.SubItems(2) =
Format(rs.Fields.Item("LastModDate").Value, "mm/dd/yyyy")
.SubItems(3) = Replace(rs.Fields.Item("Note").Value,
vbCrLf, " ") & ""
.ToolTipText = rs.Fields.Item("Note").Value & ""
'<----does not work!
End With
rs.MoveNext
Loop
rs.Close
Also, is there a way to allow the columns to display "thicker" than 1
row?
Post by Brian McCullough
Thanks again!
Brian
Post by Ken Halter
Post by Brian McCullough
Hello all,
Is there a way to display a ToolTip in a VB6 ListView when the mouse is
idle for a second or two?
I would like similar functionality as the Windows Explorer panel which
displays information about an item if the mouse stays over it for a
second or so (i.e. the file attributes).
Thanks in advance!
Brian
Each ListItem/ListSubItem has a ToolTipText property...
'==============
Private Sub Form_Load()
Dim i As Integer
With ListView1
.View = lvwReport
.ColumnHeaders.Add , , "Item"
.ColumnHeaders.Add , , "SubItem"
For i = 1 To 10
With .ListItems.Add
.Text = "Item " & i
.ToolTipText = "Here's the tooltip for " & .Text
With .ListSubItems.Add
.Text = "SubItem " & i
.ToolTipText = "Here's the tooltip for " & .Text
End With
End With
Next
End With
End Sub
'==============
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
MikeD
2004-09-24 21:41:29 UTC
Permalink
Bryan, perhaps you need to look through Brian's code again. <g> Brian's
code is using ToolTipText of a ListItem object (not how I would have done it
[using a With block on the Add method of ListItems], but a ListItem object
nonetheless).

Mike
Post by Bryan Dickerson
Read thru his code again. He doesn't use the .Subitems property, he uses
the .ListSubItems collection for each Item. Each item under that has a
.Text and a .ToolTip property.
Post by Brian McCullough
Thanks Ken,
For some reason, I do not have the ToolTipText available to me!?!?!?
Do While Not rs.EOF
With lvClientNotes.ListItems.Add(,
CStr(rs.Fields.Item("NoteId").Value) & "K", rs.Fields.Item("Type").Value &
"")
.SubItems(1) =
RTrim(rs.Fields.Item("LastModUser").Value) & ""
.SubItems(2) =
Format(rs.Fields.Item("LastModDate").Value, "mm/dd/yyyy")
.SubItems(3) = Replace(rs.Fields.Item("Note").Value,
vbCrLf, " ") & ""
.ToolTipText = rs.Fields.Item("Note").Value & ""
'<----does not work!
End With
rs.MoveNext
Loop
rs.Close
Also, is there a way to allow the columns to display "thicker" than 1
row?
Post by Brian McCullough
Thanks again!
Brian
Post by Ken Halter
Post by Brian McCullough
Hello all,
Is there a way to display a ToolTip in a VB6 ListView when the mouse is
idle for a second or two?
I would like similar functionality as the Windows Explorer panel which
displays information about an item if the mouse stays over it for a
second or so (i.e. the file attributes).
Thanks in advance!
Brian
Each ListItem/ListSubItem has a ToolTipText property...
'==============
Private Sub Form_Load()
Dim i As Integer
With ListView1
.View = lvwReport
.ColumnHeaders.Add , , "Item"
.ColumnHeaders.Add , , "SubItem"
For i = 1 To 10
With .ListItems.Add
.Text = "Item " & i
.ToolTipText = "Here's the tooltip for " & .Text
With .ListSubItems.Add
.Text = "SubItem " & i
.ToolTipText = "Here's the tooltip for " & .Text
End With
End With
Next
End With
End Sub
'==============
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
MikeD
2004-09-24 20:57:13 UTC
Permalink
Post by Brian McCullough
Thanks Ken,
For some reason, I do not have the ToolTipText available to me!?!?!?
.ToolTipText = rs.Fields.Item("Note").Value & ""
'<----does not work!
Are you getting a "Method or data member not found" compile-time error? If
so, are you sure you're using the VB6 version of Windows Common Controls?
The VB5 version does not have this property for a ListView control. If
you're not getting this error, then explain "does not work". That could
mean anything.

Mike
Brian McCullough
2004-09-24 20:26:26 UTC
Permalink
I have the columns set during design time. I also have the View set to
lvReport during design time. Don't know if this makes a difference.
Post by Ken Halter
Post by Brian McCullough
Hello all,
Is there a way to display a ToolTip in a VB6 ListView when the mouse is
idle for a second or two?
I would like similar functionality as the Windows Explorer panel which
displays information about an item if the mouse stays over it for a
second or so (i.e. the file attributes).
Thanks in advance!
Brian
Each ListItem/ListSubItem has a ToolTipText property...
'==============
Private Sub Form_Load()
Dim i As Integer
With ListView1
.View = lvwReport
.ColumnHeaders.Add , , "Item"
.ColumnHeaders.Add , , "SubItem"
For i = 1 To 10
With .ListItems.Add
.Text = "Item " & i
.ToolTipText = "Here's the tooltip for " & .Text
With .ListSubItems.Add
.Text = "SubItem " & i
.ToolTipText = "Here's the tooltip for " & .Text
End With
End With
Next
End With
End Sub
'==============
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
GILROY PONNIAH
2004-09-30 22:13:37 UTC
Permalink
Hi Brian,
Do you have any sample codes for VB6 ListView to modify the content of
specific listed column items.
Thank you.
Rgds,
Gilroy.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Brian McCullough
2004-09-24 21:06:29 UTC
Permalink
How can i automatically set the width of the columns in a vb6 listview
control?

Brian
Post by Brian McCullough
Hello all,
Is there a way to display a ToolTip in a VB6 ListView when the mouse is
idle for a second or two?
I would like similar functionality as the Windows Explorer panel which
displays information about an item if the mouse stays over it for a second
or so (i.e. the file attributes).
Thanks in advance!
Brian
Ken Halter
2004-09-24 21:29:46 UTC
Permalink
Post by Brian McCullough
How can i automatically set the width of the columns in a vb6 listview
control?
Brian
See:

Autosizing ListView Columns via API
http://vbnet.mvps.org/index.html?code/comctl/lvcolumnautosize.htm
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
MikeD
2004-09-24 21:49:48 UTC
Permalink
Post by Brian McCullough
How can i automatically set the width of the columns in a vb6 listview
control?
For each column of the ListView, send it an LVM_SETCOLUMNWIDTH message.
Here's an example:

Private Const LVM_FIRST As Long = &H1000
Private Const LVM_SETCOLUMNWIDTH As Long = LVM_FIRST + 30
Private Const LVSCW_AUTOSIZE As Long = -1
Private Const LVSCW_AUTOSIZE_USEHEADER As Long = -2


Public Sub AutoSizeLVColumns(oLV As MSComctlLib.ListView, Optional ByVal
bUseHeader As Boolean = True)

Dim lColumnIndex As Long

For lColumnIndex = 0 To oLV.ColumnHeaders.Count - 1
If bUseHeader Then
Call SendMessage(oLV.hwnd, LVM_SETCOLUMNWIDTH, lColumnIndex,
ByVal LVSCW_AUTOSIZE_USEHEADER)
Else
Call SendMessage(oLV.hwnd, LVM_SETCOLUMNWIDTH, lColumnIndex,
ByVal LVSCW_AUTOSIZE)
End If
Next

End Sub

Mike
Loading...