This project is read-only.

Multi-line Tooltip (VBA)

Jun 13, 2016 at 11:00 AM
Hi All,

I'm having issues creating a multi-line tooltip in excel, this is the code I have so far:
Private Sub Map1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)
Dim ttstr As String

ttstr = "Line1" & vbCrLf & "Line2"
Map1.ShowToolTip ttstr, 1000

End Sub
Any help would be appreciated :)
Jun 13, 2016 at 11:42 AM
I had the same problem with labels and ended up with this (in C#)
if (se.MapType == Constants.MAP_ZDEV_WELL2)
{
labexp = "[well]";
}
else
{
labexp = "[well]+" + "\"\n\"" + "+[depth]";
}
shpfile_depth.Labels.Generate(labexp, MapWinGIS.tkLabelPositioning.lpLongestSegement, true);

2016-06-13 12:01 GMT+02:00 Belleye <[email removed]>:

From: Belleye

Hi All,

I'm having issues creating a multi-line tooltip in excel, this is the code I have so far:
Private Sub Map1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)
Dim ttstr As String

ttstr = "Line1" & vbCrLf & "Line2"
Map1.ShowToolTip ttstr, 1000

End Sub
Any help would be appreciated :)

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jul 22, 2016 at 8:22 AM
For anyone else facing the same problem here is the code I'm using:
Private Sub Map1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long) ' Datatips need to add timer
    Dim sf As MapWinGIS.Shapefile
    Dim ex As New MapWinGIS.extents
    Dim xProjected As Double
    Dim yProjected As Double
    Dim ttstr As String
    Dim ShapeIDs As Variant
    Dim ActiveLayer As Long
    Dim result As Boolean
    Dim MyArr As Variant
    Dim i As Long
    ' Add timer code so as to only update if mouse is static for period of time
    If Form1.Map1.CursorMode <> cmIdentify Then Exit Sub ' optional to disable tooltip
    
    ActiveLayer = 0
    Set sf = Form1.Map1.GetObject(ActiveLayer)
    
    Form1.Map1.PixelToProj x, y, xProjected, yProjected
    ex.SetBounds xProjected, yProjected, 0, xProjected, yProjected, 0
    result = sf.SelectShapes(ex, 0, INTERSECTION, ShapeIDs)
    
    If result = True Then
        For i = 0 To UBound(ShapeIDs)
            sf.Labels.Clear
            MyArr = Split(sf.CellValue(2, ShapeIDs(i)), "&")
            ttstr = sf.CellValue(1, ShapeIDs(i)) & vbCrLf & "Colour = " & MyArr(0) & vbCrLf & "LineStyle = " & MyArr(1) & vbCrLf & "Pattern = " & MyArr(2)
            sf.Labels.AddLabel ttstr, xProjected, yProjected
        Next i
    Else
        sf.Labels.Clear
    End If
    
    Form1.Map1.Redraw
End Sub
Marked as answer by Belleye on 7/22/2016 at 12:22 AM