Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General / September 2004



Tip: Looking for answers? Try searching our database.

ToolTip in vb6 ListView?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian McCullough - 24 Sep 2004 20:55 GMT
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 - 24 Sep 2004 21:04 GMT
> Hello all,
>
[quoted text clipped - 8 lines]
>
> 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
'==============

Signature

Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

Brian McCullough - 24 Sep 2004 21:17 GMT
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

>> Hello all,
>>
[quoted text clipped - 30 lines]
> End Sub
> '==============
Bryan Dickerson - 24 Sep 2004 21:24 GMT
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.

> Thanks Ken,
>
[quoted text clipped - 58 lines]
> > End Sub
> > '==============
Brian McCullough - 24 Sep 2004 21:50 GMT
I was using an older version of the ListView control.

> 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
[quoted text clipped - 65 lines]
>> > End Sub
>> > '==============
MikeD - 24 Sep 2004 22:41 GMT
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

> 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
[quoted text clipped - 63 lines]
> > > End Sub
> > > '==============
MikeD - 24 Sep 2004 21:57 GMT
> 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 - 24 Sep 2004 21:26 GMT
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.

>> Hello all,
>>
[quoted text clipped - 30 lines]
> End Sub
> '==============
GILROY PONNIAH - 30 Sep 2004 23:13 GMT
Hi Brian,
Do you have any sample codes for VB6 ListView to modify the content of
specific listed column items.
Thank you.
Rgds,
Gilroy.
Brian McCullough - 24 Sep 2004 22:06 GMT
How can i automatically set the width of the columns in a vb6 listview
control?

Brian

> Hello all,
>
[quoted text clipped - 8 lines]
>
> Brian
Ken Halter - 24 Sep 2004 22:29 GMT
> 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

Signature

Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

MikeD - 24 Sep 2004 22:49 GMT
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.