I have an ultra text editor on which I've defined a right button which is a DropDownEditorButton which has an ultragird as it's control. I have actions that take place on the double click event of the grid after which I want the drop down to close up.
I've tried 'txtSearch.Editor.CloseUP' and 'txtSearch.Editor.ExiteditMode (true, true) and neither works.
How do I get the dropdown to close up in the grid double click?
Hello Tigerpaw,
You could try the following approach to resolve your issue(assuming your ultraGrid is named ultraGrid1 and is part of the dropDownButton Editor property):
private void ultraGrid1_DoubleClick(object sender, EventArgs e) { ultraTextEditor1.CloseEditorButtonDropDowns(); }
private void ultraGrid1_DoubleClick(object sender, EventArgs e)
{
ultraTextEditor1.CloseEditorButtonDropDowns();
}
Feel free to write me if you need further assistance.
Thank you Boris. That worked great. Now I have another related question. I need to be able to activate the drop down using keyboard input. I looked for a shortcut key property but finding none, I've tried adding code to the text editor(txtSearch) keydown event.
I've used the code below but when it gets hit, the code crashes and exits. What should I call?
If e.KeyCode = Keys.Down Then ' down arrow
txtSearch.Editor.DropDown
End If
Thanks
Linda
Hi Linda,
Since the UltraTextEditor can have multiple dropdown buttons in the ButtonsRight and/or ButtonsLeft collection, you can't drop it down via a method on the control or the editor - there's not enough context for it to know which button to drop down.
This is not true of closing the dropdown, since there can only be one open dropdown at a time.
What you have to do is get the DropDownEditorButton you want from the collection, cast it to an DropDownEditorButton, and then call the DropDown method on the button.
Private Sub UltraTextEditor1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UltraTextEditor1.KeyDown If e.KeyCode = Keys.Down Then Dim button As DropDownEditorButton = CType(Me.UltraTextEditor1.ButtonsRight(0), DropDownEditorButton) Button.DropDown() End If End Sub
I used index 0 here, assuming I only have one button in the collection or that my button is always the first one in the collection. It would be better to use a Key, of course, since the Key doesn't change.
Thank you for the response. I tried your example both using the button key rather and the ordinal. Both still cause vb to crash. I did notice one thing. If I put a breakpoint on the button.dropdown statement and continue after the break, it does not crash but it also does not display the drop down.
Could it make a difference that I have 2 right buttons? The second is just an editor button that brings up another form - no drop down.
Hello Linda,
I tried Mike's suggestion and it seems to be working for me. I tried to reproduce your scenario and prepared a sample for you.
Please review it and feel free to ask anything else.
Boris,
Thanks for taking the time to produce the sample. I downloaded it but am having version problems(which may be my problem). vb cant find the v11.1 assembly references. I'll try the sample when I get it figured out.
I think that most probably you do not have the latest 11.1 version of NetAdvantage currently installed and that is why you have version issues. So what you could do is the following:delete the v11.1 assemblies, then add the assemblies needed within the version installed on your personal computer.
I hope this helps.
Please let us know if you still need any help.