Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
460
showing tooltip in ultratree
posted

hi,

I'm trying to show tooltip in ultratree for cell value that's clipped but it doesn't seem to work. In

UltraTree1.MouseEnterElement, i check if the element is fully visible and it always return True even the item is clipped. Here's sample code:

 

Private _nameColumn As UltraTreeNodeColumn = Nothing

Private _valueColumn As UltraTreeNodeColumn = Nothing

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

With UltraTree1

.DisplayStyle = UltraTreeDisplayStyle.WindowsVista

.ViewStyle = ViewStyle.OutlookExpress

With .ColumnSettings

.AutoFitColumns = AutoFitColumns.ResizeAllColumns

End With

End With

Dim rootColumnSet As UltraTreeColumnSet = UltraTree1.ColumnSettings.RootColumnSet

_nameColumn = rootColumnSet.Columns.Add("Name")

_valueColumn = rootColumnSet.Columns.Add("Value")

With _nameColumn

.DataType = GetType(String)

.LayoutInfo.PreferredCellSize = New Size(CInt(Me.Width / 2), 0)

End With

With _valueColumn

.DataType = GetType(Object)

.LayoutInfo.PreferredCellSize = New Size(CInt(Me.Width / 2), 0)

End With

 

Dim root As UltraTreeNode = Me.UltraTree1.Nodes.Add("root level 1")

root.SetCellValue(_nameColumn, 1)

root.SetCellValue(_valueColumn, "The Editor property can be set to any of the editors provided by the Win assembly, as the EditorControl property can be set to any of the controls in the UltraWinEditors assembly.")

Dim child As UltraTreeNode = root.Nodes.Add("child level 1")

child.SetCellValue(_nameColumn, 2)

child.SetCellValue(_valueColumn, "short message")

UltraTree1.ExpandAll()

End Sub

 

Private Sub UltraTree1_MouseEnterElement(ByVal sender As Object, ByVal e As Infragistics.Win.UIElementEventArgs) Handles UltraTree1.MouseEnterElement

Dim pt As New Point(e.Element.Rect.X, e.Element.Rect.Y)

Dim node As Infragistics.Win.UltraWinTree.UltraTreeNode = UltraTree1.GetNodeFromPoint(pt)

If node Is Nothing Then

UltraToolTipManager1.HideToolTip()

Return

End If

Dim nValue As Object = node.Cells(_valueColumn).Value

If nValue Is Nothing Then

UltraToolTipManager1.HideToolTip()

Return

End If

If String.IsNullOrEmpty(nValue.ToString) Then

UltraToolTipManager1.HideToolTip()

Return

End If

If e.Element.IsFullyVisible = True Then

UltraToolTipManager1.HideToolTip()

Return

End If

Try

Dim tipInfo As New Infragistics.Win.UltraWinToolTip.UltraToolTipInfo( _

nValue.ToString, _

Infragistics.Win.ToolTipImage.Default, "", _

Infragistics.Win.DefaultableBoolean.True)

UltraToolTipManager1.SetUltraToolTip(UltraTree1, tipInfo)

UltraToolTipManager1.ShowToolTip(UltraTree1)

Catch ex As Exception

End Try

End Sub

Parents
No Data
Reply
  • 69832
    Offline posted

    IsFullyVisible only tells you whether the element's ClipRect is smaller than the element's Rect. It is not really useful for your purposes here. You might have better luck with something like the following:

    Example:
    private void ultraTree1_MouseEnterElement(object sender, UIElementEventArgs e)
    {
        EditorWithTextUIElement element = e.Element as EditorWithTextUIElement;
        if ( element != null && element.IsDataFullyVisible == false )
        {
            //  Show tooltip
        }
    }

Children