I would have thought this had a simple answer but maybe I'm overlooking something. Here's the scenario, I have an UltraTextEditor with a single DropDownEditorButton in the ButtonsRight collection. This button's Control property is wired to an UltraMonthViewMulti calendar control. When the button is clicked, the calendar control opens perfectly aligned as expected.
Challange - The UltraTextEditor must support an F4 key press that effectively forces the click of the DropDownEditorButton thus opening the calendar. Here's some code...
Private Sub UltraTextEditor_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UltraTextEditor.KeyDown If e.KeyValue = System.Windows.Forms.Keys.F4 Then 'Some how force the ButtonsRight(0) DropDownButton to fire End If End Sub
Question - How can I accomplish this? I would have thought that you could have simply done something like the following but it apparently doesn't exist.
ex: Me.UltraTextEditor.ButtonsRight(0).Click()
Any help would be greatly appreciated.
It figures, right after I post the question, I found the solution. For those of you who care, here's the code to make it work.
Private Sub UltraTextEditor_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UltraTextEditor.KeyDown If e.KeyValue = System.Windows.Forms.Keys.F4 Then 'Some how force the ButtonsRight(0) DropDownButton to fire Dim oButton As Infragistics.Win.UltraWinEditors.DropDownEditorButton = Me.UltraTextEditor.ButtonsRight(0) oButton.DropDown() End If End Sub
This doesn't work for me.
It says I need to put my editor into EditState.
When I do an oButton.Editor.EnterEditState it requires a paramter of type EmbeddableUIElementBase, which the docs do not then elaborate on.
Any more clues?
[edit]
A method along the lines of the OP's "oButton.Click" would be insanely helpful.
Oh, I see. You are trying to drop down the wrong button. The grid isn't using the UltraTextEditor control on the form. You need to use the EditorResolved property of the cell to get the editor of that cell. Cast it into an EditorDropDownButtonBase to access the ButtonsRight collection and get the button from there, then call the dropdown method on that button.
Erg - I finally got around to implementing this. The compiler's not letting me do the cast as described, and I can't find "EditorDropDownButtonBase" in the online help. Could you mean "EditorWithTextAndDropDownBase" or "EmbeddableEditorButtonBase"?
(Love those descriptive class names...)
FWIW, the EditorResolved is coming back as type Infragistics.Win.EditorWithText in the Immediate window.
[time passes]
It casts successfully as a Infragistics.Win.UltraWinEditors.EmbeddableEditorButtonBase but tells me when I tell it to ".DropDown" that "This editor does not support dropdowns."
So it's not the UltraTextEditor on the form that I need to use, and it's not whatever this EmbeddableEditorButtonBase is...
Help?
Also doesn't show a dropdown:
If Not _Grid.ActiveCell.DroppedDown Then _Grid.PerformAction(UltraGridAction.EnterEditModeAndDropdown) End If
Okay, THIS finally worked!
Dim cButton As Infragistics.Win.UltraWinEditors.EmbeddableEditorButtonBase = Nothing cButton = TryCast(Grid.ActiveCell.EditorResolved, Infragistics.Win.UltraWinEditors.EmbeddableEditorButtonBase) Dim ddb As Infragistics.Win.UltraWinEditors.DropDownEditorButton = TryCast(cButton.ButtonsRight(0), Infragistics.Win. UltraWinEditors.DropDownEditorButton) If ddb IsNot Nothing Then ddb.DropDown()
Now to set the input focus to the tree that's displayed inside the tab control that's displayed by the button's dropdown. THEN I'm home free...
Sorry about that, I don't know where I got that type name from. What you have here is correct.