Hi,
I want a combo box which would behave like the combox box present on FileOpenDialog. This combo box display its contains in tree view manner in its drop down list. If there is any special control in infragistic, please let me know. If not, how should i proceed?
Thanks in adavance,
Ujwal Salunkhe
Hi Ujwal,
There's no control with a dropdown tree built-in. But you can make your own and it's pretty easy. Place an UltraTextEditor control on a form and use the ButtonsRight collection to add a DropDownEditorButton. Set this button's Control property to an UltraWinTree control.
You now have a dropdown control with a tree on it. And the best part is that this control is an editor. So you could use it as the EditorControl of a grid cell, for example.
Hi Mike,
Thanks for the help. I will try it and let you know.
Thanks,
Ujwal
Brain, i did this using the designer and not at the runtime. That could be the reason i didn't get the event.
I solved the problem by adding a double-click event and in the Tree_AfterSelect event i would call double-Click event so that it closes.
Now, after selecting a value from tree, the TextEditor is set to the that value.Next time the user clicks on the dropdowneditor button, treeview is shown but the node is not selected by default.
Eg: User selects the last leaf node and comes back to the treeview. I have a scroll bar (vertical) and hence it shows from the top, user is not able to see the treeview with the node selected.
Instead, the tree view should be displayed with the value in the texteditor as the selected node. Is that possible?
Thanks.,
Handle the DropDownEditorButton's BeforeDropDown event, and match the text in the UltraTextEditor to a node. If the node keys are the same as the text, you can use UltraTree's GetNodeByKey method to find the node. Once you have a reference to the node, you can set its Selected property to true.
I found this thread as I was searching for example of your Tree Control. Will the solution provided by you that involves using AfterSelect work when the user is using the keyboard to navigate the tree? Based on my preliminary tests, the first node that the user moves to will trigger the AfterSelect event. Presumably, the user hasn't "selected" a node until he/she hits the 'Enter' key. Everything works fine with the AfterSelect event if I test with just the mouse.
Andrew
The user who was looking for assistance on this mentioned AfterSelect, so I used that to keep things simple. The key here is that you have to tell the dropdown when to close. As you pointed out, doing it in response to AfterSelect will cause it to close when a node is selected via the keyboard, which is probably not ideal for most applications. You could easily change that to close in response to the KeyDown event when the Enter key comes in, and also when a MouseUp comes in (or MouseClick, MouseDoubleClick, etc.), i.e., whatever action you decide should close the dropdown. You could even have a more sophisticated dropdown where you put the UltraTree on a UserControl, along with a close button, and close the dropdown when that button is clicked.
Brian,
I ran into one snag using MouseUp and KeyDown... Using the scrollbar results in a MouseUp and my treecontrol closing. I need some way to distinguish between click on tree items, and simply using the scrollbar. I have the following code (abbreviated for clarity):
}
Can you suggest a work around or different approach?
In case anyone looks this up in the future, the key seems to be to use something like:
Do a search for the posting
"Doubleclick on scrollbar in UltraTree" for more details.