Home > Archive > Visual Basic > September 2004 > ToolTip in vb6 ListView?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ToolTip in vb6 ListView?
|
|
| Brian McCullough 2004-09-24, 8:55 pm |
| 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, 8:55 pm |
| Brian McCullough wrote:
> 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, 8:55 pm |
| 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
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:eRhhpGnoEHA.2588@TK2MSFTNGP12.phx.gbl...
> Brian McCullough wrote:
>
> 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, 8:55 pm |
| 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.
"Brian McCullough" <nomorespammingme@myemailaddress.com> wrote in message
news:ufqY$NnoEHA.3488@TK2MSFTNGP12.phx.gbl...
> 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
>
> "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
> news:eRhhpGnoEHA.2588@TK2MSFTNGP12.phx.gbl...
>
>
| |
| Brian McCullough 2004-09-24, 8:55 pm |
|
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.
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:eRhhpGnoEHA.2588@TK2MSFTNGP12.phx.gbl...
> Brian McCullough wrote:
>
> 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, 8:55 pm |
| I was using an older version of the ListView control.
"Bryan Dickerson" <txprphan@netscape.net> wrote in message
news:%23ZsCbSnoEHA.516@TK2MSFTNGP09.phx.gbl...
> 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.
>
> "Brian McCullough" <nomorespammingme@myemailaddress.com> wrote in message
> news:ufqY$NnoEHA.3488@TK2MSFTNGP12.phx.gbl...
> row?
>
>
| |
|
|
"Brian McCullough" <nomorespammingme@myemailaddress.com> wrote in message
news:ufqY$NnoEHA.3488@TK2MSFTNGP12.phx.gbl...
> 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, 8:55 pm |
| How can i automatically set the width of the columns in a vb6 listview
control?
Brian
"Brian McCullough" <nomorespammingme@myemailaddress.com> wrote in message
news:%23VSA3BnoEHA.3552@TK2MSFTNGP15.phx.gbl...
> 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
>
| |
|
|
|
| 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
"Bryan Dickerson" <txprphan@netscape.net> wrote in message
news:%23ZsCbSnoEHA.516@TK2MSFTNGP09.phx.gbl...
> 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.
>
> "Brian McCullough" <nomorespammingme@myemailaddress.com> wrote in message
> news:ufqY$NnoEHA.3488@TK2MSFTNGP12.phx.gbl...
&[color=darkred]
> row?
is[color=darkred]
which[color=darkred]
>
>
| |
|
|
"Brian McCullough" <nomorespammingme@myemailaddress.com> wrote in message
news:eZKydpnoEHA.1300@TK2MSFTNGP12.phx.gbl...
> 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
| |
| GILROY PONNIAH 2004-09-30, 8:55 pm |
| 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!
|
|
|
|
|