I have an UltraTree placed within UltraExplorerBarContainerControl that is one of the items on UltraExplorerBar navigation control docked to the left side of the screen. This tree has numerous nodes and if expanded UltraExplorerBar vertical scroll bar appears as it should. The problem is whilst the UltraExplorerBar handles MouseWheel event when the mouse is over the expanded tree (takes most of the vertical space) MouseWheel Up or Down has no effect - the scroll does not work. The MouseWheel event within the tree is firing but since the control is hosted within the container control no scrolling occurs.
To resolve this issue I am trying to initiate programmatic scrolling of the UltraExplorerBar on tree_MouseWheel() event however I noticed that UltraWinExplorerBar.UltraExplorerBarAction enumerator supports only ScrollPageUp and ScrollPageDown which scrolls an entire page at a time (similar to what happens when user clicks on the scrollbar) rather than actual scrolling. Do you have any suggestions on how this issue can be resolved?
I am using UltraWinExplorerBar 9.2.20092.2042 and UltraWinTree 9.2.20092.2042. Thanks.
Hello,
What style do you have the UltraExplorerBar set to? I made a small sample and tried with several different styles and I found that with some styles, you have to click on the control in order for the mouse wheel to scroll the tree. The only code I wrote was to populate the UltraTree with 100 nodes.
Also, I made my sample using 10.2.20102.2058. If clicking on the UltraTree doesn't allow scrolling, try it with a newer version of our product.
The style is UltraExplorerBarStyle.VisualStudio2005Toolbox. Clicking on tree first does not seem to help and even if it worked that behavior would be inconsistent as the rest of the bar can be scrolled by the mouse wheel just while hovering over the bar area. Since it does not seem to work correctly even in version 10 should that be considered an enhancement request?
I created another sample that includes the built-in Windows Forms TreeView control and another group with a large number of items. I've attached the sample to this post. I built it with 10.3, but if you use the Project Upgrade Utility/Add-on, you'll be able to run it with 9.2.
Once you've launched the sample, you'll see that the ExplorerBar itself can be scrolled, but not the TreeView. However, when you click on the button and then try to scroll the ExplorerBar with the mouse wheel, it won't scroll. This is because a .NET Framework Windows Forms control needs focus in order to be able to be scrolled with the mouse wheel.
There is a way to achieve this.
First, trap mouse wheel messages and forward to control, which is hovered. Like so: http://social.msdn.microsoft.com/Forums/windows/en-US/eb922ed2-1036-41ca-bd15-49daed7b637c/outlookstyle-wheel-mouse-behavior
Then, attach to UltraExplorerBar.MouseWheel event and manually invoke scrolling. Since API is not exposed (or I haven't got time to find it), I used reflections. Here is event handler code:
private void HandleExplorerBarMouseWheel(object sender, MouseEventArgs e) { // If there is selected group: if (this.explorerBar.SelectedGroup != null) { // Invoke scroll method: Type type = typeof(UltraExplorerBarGroup); MethodInfo scrollMethod = type.GetMethod("DoVerticalScroll_Listbar", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[1] { typeof(ScrollEventType) }, null); if (scrollMethod != null) scrollMethod.Invoke(this.explorerBar.SelectedGroup, new object[1] { e.Delta > 0 ? ScrollEventType.SmallDecrement : ScrollEventType.SmallIncrement }); } }