Regards,
How I can use to control UltraToolstips with UltraStateBar control?
How to apply to ToolTips each statusbar panel
Thanks in advance
Hi,
The inbox ToolTip class and the UltraToolTipManager apply a tooltip to a control.
If you want to apply a tooltip to part of a control, what you would typically do is change the tooltip on the control based on the current location of the mouse. The MouseMove event if usually a good place to do this.
You will also need to force the tooltip to re-display if the user moves from one panel to another without leaving the control. This can be done by keeping track of the last panel for which you displayed a tooltip. Here's some quick sample code.
private UltraStatusPanel lastMouseMovePanel; private void ultraStatusBar1_MouseMove(object sender, MouseEventArgs e) { UIElement element = this.ultraStatusBar1.UIElement.LastElementEntered; if (element == null) return; UltraStatusPanel panel = element.GetContext(typeof(UltraStatusPanel)) as UltraStatusPanel; if (panel == null || panel == this.lastMouseMovePanel) return; this.lastMouseMovePanel = panel; UltraToolTipInfo tooltipInfo = new UltraToolTipInfo("This is panel " + panel.Index, ToolTipImage.None, "Title", DefaultableBoolean.True); this.ultraToolTipManager1.SetUltraToolTip(this.ultraStatusBar1, tooltipInfo); this.ultraToolTipManager1.ShowToolTip(this.ultraStatusBar1); }
Hi Mike,
Thanks for youe answer....I "translate" the code from C# to VB...the result is something like this:
Private _lastMouseMovePanel As UltraStatusPanel
Private Sub StatusBar_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles StatusBar.MouseMove
Dim element As UIElement = Me.StatusBar.UIElement.LastElementEntered If Not IsNothing(element) Then Dim myPanel = element.GetContext(GetType(UltraStatusPanel)) If Not myPanel Is Nothing Then Me._lastMouseMovePanel = myPanel Dim tooltipInfo As UltraToolTipInfo = New UltraToolTipInfo("This is panel " + CStr(myPanel.Index), ToolTipImage.None, "Title", DefaultableBoolean.True) Me.MainToolTipManager.SetUltraToolTip(Me.StatusBar, tooltipInfo) Me.MainToolTipManager.ShowToolTip(Me.StatusBar) End If End If
End Sub
This code "works", I meant....do not show error and all the ojects and variables are filled but....the ToolTips is not displayed.....
There´s something wrong or missing with this code?
Thanks
PD: Sorry my english Mike
It looks like you left out the check that bails out if the panel is the same as the lastMouseMove Panel.You are only checking for null, but you didn't include the second part of this check:
if (panel == null || panel == this.lastMouseMovePanel) return;If Not myPanel Is Nothing AndAlso Not myPanel is Me._lastMouseMovePanel Then
I don't know why that's happning. My sample worked fine for me, so it must be something different in your code than mine. Or maybe there's some other code in your application which is somehow interfering with this. Are you handling any other events of the StatusBar?
If you'd like to post a small sample project demontrating the behavior you are getting, I'd be happy to take a look at it.
Greetings Mike,Thanks for your quick response .... and thanks for that line that had "lost " in translation....Reviewing a bit I found the following behavior: the tooltips does show, but strangely onlyhappens when the cursor is between the limit (a very small space) between a panel andanother.Both panels in text .....
See the next image...
The tooltip appears to apply only to the control panel but not the (text) from this.Is there any way to fix this behavior?Thanks in advance .....