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
Yep. That was my idea, but how to trigger that event from treeview_afterselect event? More over it is a control placed on top of UltraTextEditor control.
VV
Sorry, I don't understand your question. The DropDownEditorButton class exposes a CloseUp method (not event), which you can call directly when a node is selected, thus causing the dropdown to close. I also don't understand your statement, "...it is a control placed on top of UltraTextEditor control." If you could please repost with clarification we can try to help.
I was using the treeview_AfterSelect event to get the selected node into the ultratext editor. So was not able to get the DropDownEditorButton class' CloseUp method.Anyhow i solved the problem by calling the treeview_DoubleClick to close the tree and make the selected node available as text in the ultratext editor.
Thanks Brian,
Sorry, I am still not following why you were "not able to get the DropDownEditorButton class' CloseUp method", but hopefully the following code sample will clarify the correct approach:
using Infragistics.Win;using Infragistics.Win.UltraWinEditors;using Infragistics.Win.UltraWinTree;
private void button1_Click(object sender, EventArgs e){ // Create a DropDownEditorButton DropDownEditorButton dropDownButton = new DropDownEditorButton( "dropDownButton" );
// Create an UltraTree, set its size, add some nodes UltraTree treeControl = new UltraTree(); treeControl.Size = new Size( this.ultraTextEditor.Width, 200 ); for ( int i = 0; i < 100; i ++ ) { treeControl.Nodes.Add( null, "Node" + i.ToString() ); } // Assign the UltraTree to the DropDownEditorButton's Control property dropDownButton.Control = treeControl;
// Add the DropDownEditorButton to the UltraTextEditor's ButtonsRight collection this.ultraTextEditor.ButtonsRight.Add( dropDownButton );
// Assign a reference to the UltraTextEditor to the UltraTree's Tag property. treeControl.Tag = this.ultraTextEditor;
// Handle the UltraTree's AfterSelect event treeControl.AfterSelect += new AfterNodeSelectEventHandler(treeControl_AfterSelect);}
private void treeControl_AfterSelect(object sender, SelectEventArgs e){ UltraTree tree = sender as UltraTree; if ( e.NewSelections.Count == 1 ) { UltraTextEditor ute = tree.Tag as UltraTextEditor; if ( ute != null && ute.ButtonsRight.Exists("dropDownButton") ) { // Assign the selected node's text to the UltraTextEditor's Text property ute.Text = e.NewSelections[0].Text; DropDownEditorButton dropDownButton = ute.ButtonsRight["dropDownButton"] as DropDownEditorButton;
// Close the dropdown dropDownButton.CloseUp(); } }}
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.,
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.
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?
Andrew
UltraWinTree hides the selection by default when it does not have focus. The Inbox tree control does the same thing.
Try setting HideSelection on the tree to false and see if that helps.
I tried it, but in vain. Below is the code snippet that i wrote inside BeforeEditorButtonDropDown event..,
{
Anything wrong here? The cursor was in the UltraFieldTextEditor., may be is that a reason?
Thanks,.
Thanks. That's the way I started to implement it. Nice to know I'm on the right path.
-Andrew