Hello,
I was testing if it was possible to scroll the ultrawintree if the tree doesnt have focus. I want to be able if the tree doesnt have focus to scroll the tree when the cursor is in the treeregion.
This works for the .NET treeview, but not for the ultrawintree.
Is this even possible with the ultrawintree?
Thanks.
UltraTree exposes a TopNode property, which when set to a node that is not in view, will scroll the control as needed. This also works when the control does not have the input focus.
Thanks for the quick answer.
I am sorry, this is not what i meant. I am looking for a solution for this situation.
Lets say you have an ultratree at your left side and a tabpage for example on the right side. when the ultratree have focus i can scroll with the mousebutton, logical. But when the tabpage is focused i want that when the mousecursor is in the region of the ultratree i can use the scrollbutton of the mouse to scroll the tree.
thanks.
Hi Kevin,
I don't think this has anything to do with the tree. The mouse driver sends the MouseWheel messages to whatever control has the input focus, not necessarily the control that the mouse is currently over. So I don't beleive that what you want to do there is possible, unless maybe you set focus to the tree in the tree's MouseEnter event - which is probably not a good idea.
Yeah, i thought to do that to. I also tried to implemented the imessagefilter and did a sendmessage whenever the mousescroll is used within the ultratree without having focus. Btw this is working with the .net treeview.
KevinKlein said: this is working with the .net treeview.
Which part of this works with the MS Tree? You mean it works automatically? Or it works when you use the SendMessage?
I can see how SendMessage might work, since the DotNet TreeView class is a wrapper for the Windows Tree. But UltraTree is not and therefore would not work the same way. Of course, if you are using a MessageFilter, you could just scroll the WinTree in code without sending a message.
Not automatically, but when you execute SendMessage.
Mike Saltzman"]Of course, if you are using a MessageFilter, you could just scroll the WinTree in code without sending a message.
Is this possible, i mean without having focus?In my example i have used in .NET tree and the ultratree, the .NET tree responds at SendMessage when there isnt focus, but the ultratree doesnt.
Thanks Mike,
This works indeed.
Hi,
The ScrollDown and ScrollUp actions handle what happens when you press the up or down arrow keys and there is no focus rectangle on the tree. This only applies in the WindowsVista-style tree.
But you can acheive the same thing like so:
private static void ScrollTree(UltraTree tree, bool up) { UltraTreeNode topNode = tree.TopNode; if (topNode == null) return; UltraTreeNode newTopNode = topNode.NextVisibleNode; if (up) { newTopNode = topNode.PrevVisibleNode; } else { newTopNode = topNode.NextVisibleNode; } if (newTopNode != null) tree.TopNode = newTopNode; }
By the way found that it is possible to do performaction on the tree, but when i give the ultratreeaction pageup or pagedown it works, but when i use the scrolldown or scrollup nothing happens.
Ok, thank you.
I know what kind of control is set when the mousewheel is used, can you give a some small example of how i can scroll the tree?
Sorry, perhaps I wasn't clear.
The Microsoft TreeView control is a wrapper for the Windows Tree. So it responds to Windows messages like SendMessage the same way any Windows Tree would.
The Infragistics WinTree is not a wrapper for the Windows Tree. So it will not respond to Windows message like SendMessage.
But if you want determine the control under the mouse and get a reference to that control and find that it's an UltraWinTree, you could simply scroll the tree in code.
Granted, this is not as convenient as using SendMessage, since with SendMessage you don't care what control you are sending the message to. But it should be possible to get it to work.