The default tooltip that is displayed when the node text is truncated (as determined by the Override.TipStyleNode property) prevents the control from being scrolled using the mouse wheel. The default behaviour is to display this tooltip immediately on mouse enter so there isn't even a grace period where you can get to scroll the tree before the tooltip is displayed.I have managed to work around this, what we need to do is to get hold of the actual form that is used to display the tooltip, handle it's MouseWheel event and forward it to the tree control instead. The actual tooltip object used to display the tooltip is in fact a member of the UltraTree, it just isn't public. Get hold of this object using reflection, then the form is stored in the Control property on which we register the event. Then in the MouseWheel event we need to call OnMouseWheel on the tree, I'm using reflection again to do this to save me from having to inherit from UltraTree. The code looks like this:
public Form1() { InitializeComponent(); // Get the tooltip using reflection var toolTipGet = ultraTree1.GetType().GetProperty("ToolTip", BindingFlags.NonPublic | BindingFlags.Instance); ToolTip toolTip = (ToolTip)toolTipGet.GetValue(ultraTree1, null); // Control is the form used to display the tooltip and hence gets the mouse events toolTip.Control.MouseWheel += Owner_MouseWheel; } void Owner_MouseWheel(object sender, MouseEventArgs e) { // forward to the tree var omw = ultraTree1.GetType().GetMethod("OnMouseWheel", BindingFlags.NonPublic | BindingFlags.Instance); omw.Invoke(ultraTree1, new object[] { e }); }
I would like Infragistics to build this functionality into the Form the tooltip uses (ToolTipFormEx?).
Also in other forum posts people have asked how to customize the appearance of the tooltip (specifically the font as it defaults to sans serif) and the response has been to roll your own tooltip! There is a much easier way, just set the font on the same protected tooltip object. Note don't set it on the form (tooltip.Control) as some dodgy logic in ToolTip.OnFormDisposed throws an exception when your form is disposed)
toolTip.Font = ultraTree1.Font;
cheers
Martin
Oh... regarding the font... I'm pretty sure the tooltips use the same font as the node. If they don't do this by default, then I am sure they will if you set UseEditors to true on the Override.
It doesn't use it by default - in fact all I wanted is for the tooltip font to match the node font. However the UseEditor suggestion does indeed work so this is useful information for people.
Thanks Mike,
Martin,
I believe the UltraTree has to have focus before the mouse wheel will work with it. If you click into the control I think you will see that the wheel will work even if the tooltip is displayed. I am sending you a small sample application which you can use to demonstrate this. The sample contains an Infragistics UltraTree and a Microsoft TreeView and they both seem to work the same way. Look it over and let me know what you think.
Michael S.
At least with 10.2 i have the same problem: No mouse-wheel-scrolling thru tree-items if an item-tooltip is displayed.
The tree is an UltraTree set to OutlookExpress-Style.
If this is fixed with 10.3 i would be happy.
Have you tried it with the latest service release?
How to get the latest service release - Infragistics Community
i have not and currently i can not. Our registered team-member has to download it. And before our company can update we would have to check pretty close with existing projects, that nothing will break or change.
If you have a larger project rolled out to some thousend clients, you cannot switch component-versions on the fly - we don't like to deploy too much different Assembly-Versions of 3rd-Party Controls as this will raise complexity and potentionally make forms work differently.
I thought: If you've fixed the scrolling behavior with the tooltips in some release (BTW: Same Problem with the UltraGrid in 10.2), you may know this much better then we users, don't you? :) So If you can tell us/me, that this problem is fixed with 10.3 then i'm happy because one day or another we will upgrade to this or a later version ;)
Hi,
It's very hard to say for sure, since I don't know if the problem you are having is exactly the same as the one I remember us fixing. :)
The best thing for you to do would be to download and install the Service release or a trial version of NetAdvantage 10.3 and test it out. You can always roll back the service release or uninstall the trial version after you do your test.
If you don't want to do that, then the next best thing would be for you to post a small sample project here that reproduces the issue and I will run it using the latest service release of 10.2 and/or 10.3 and let you know if I can reproduce the issue.