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
1130
ultratooltipInfo object
posted

I am using ultratooltipInfo and manager for my grids using the code listed below.  My question is "Does the ultratooltipinfo object automatically get disposed?  A new tooltipInfo Object gets set in the manager for my grid over and over, but I never explicitly remove the  old object.  I saw in documentation it said the SetToolTip method will replace any existing tooltipInfo object that is tied to the control with the new one.  Does this mean the old object gets destroyed, whether it be explicity destroyed by Infragistics code or VS garbage collection?  Or will they build up possibly causing memory issues?

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

Dim acell As UltraGridCell = CType(e.Element.GetContext(GetType(Infragistics.Win.UltraWinGrid.UltraGridCell)), UltraGridCell)

If Not acell Is Nothing AndAlso Not acell.Value.ToString = "" Then

Dim tipInfo As Infragistics.Win.UltraWinToolTip.UltraToolTipInfo

If acell.ToolTipText Is Nothing Then

tipInfo = New Infragistics.Win.UltraWinToolTip.UltraToolTipInfo(WrapToolTipText(acell.Value.ToString), ToolTipImage.None, "", DefaultableBoolean.True)

Else

tipInfo = New Infragistics.Win.UltraWinToolTip.UltraToolTipInfo(WrapToolTipText(acell.ToolTipText), ToolTipImage.None, "", DefaultableBoolean.True)

End If

Me.UltraToolTipManager1.SetUltraToolTip(_grid, tipInfo)

Me.UltraToolTipManager1.DisplayStyle = ToolTipDisplayStyle.Standard

Me.UltraToolTipManager1.ShowToolTip(_grid)

Me.UltraToolTipManager1.AutoPopDelay = 30000

End If

End Sub

Private Sub _grid_MouseLeaveElement(ByVal sender As Object, ByVal e As Infragistics.Win.UIElementEventArgs) Handles _grid.MouseLeaveElement

Dim acell As UltraGridCell = CType(e.Element.GetContext(GetType(Infragistics.Win.UltraWinGrid.UltraGridCell)), UltraGridCell)

If Not acell Is Nothing AndAlso Not acell.Value.ToString = "" Then

UltraToolTipManager1.HideToolTip()

End If

End Sub

 

Thanks in advance

Dave K.

  • 469350
    Verified Answer
    Offline posted

     Hi Dave,

    I tool a look and while UltraToolTipInfo is disposable, there's actually nothing on it that needs disposing. It is only disposable because it derives from SubObjectBase, but it doesn't override OnDispose and calling the Dispose method won't actually do anything anyway. 

    The only way this object might cause a problem is because of event hooks, but any event hooks are removed when you call SetUltraToolTip and the old ToolTipInfo is removed.

    Having said that, it seems to me that it would be more efficient to use GetUltraToolTip, instead, and then just set properties on the existing tooltip, rather than creating a new one every time.