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.
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.
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.
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.
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; }
Thanks Mike,
This works indeed.