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.
Mike Saltzman"] It sounds to me like your control doesn't have focus when you are trying to drop it down. You probably just need to set focus to the UltraTextEditor.
It sounds to me like your control doesn't have focus when you are trying to drop it down. You probably just need to set focus to the UltraTextEditor.
I tried that - it just returns "False" and won't take focus. ("CanFocus" also returns false.)
This is with the situation I described in this post - so I tried setting focus to the tree, the tab control, AND the text edit - none of them took it. According to MS help for "CanFocus:"
In order for a control to receive input focus, the control must have a handle assigned to it, and the Visible and Enabled properties must both be set to true for both the control and all its parent controls, and the control must be a form or the control's outermost parent must be a form.
And all of these criteria fit the bill, so I don't know what's going on there.
I also tried invoking "EnterEditMode" on the textedit.Editor object, but it needed a handle to another UI object (Win.EmbeddableUIEditorBase, I believe, which hadsno entry in the help files) and at that point I figured the user can just click the button to drop it down, and moved on...
Are you saying that you're trying to set the focus on the UltraTextEditor programmatically as oppose to the user tabbing into or clicking on the control prior to pressing the target key?
Yes - What I was aiming at was, when the user typed into the editbox, to pop up the tree control and search for nodes that match what'd been typed. Then have it highlight the selected node real-time as they type.
I got the part working where I could search the tree for the correct node, and do the half-highlighted-in-the-edit-box thing as they typed, but wasn't able to get the tree to popup and display the selection as they went.
But apparently to open the popup editor, I need to set focus to something that can't have focus since the user is typing into the cell in the grid at the time - and THAT needs the focus for that. And it's not really the UltraTextEditor that's being typed into or displayed at all (see linked post) but some kind of placeholder? (I'm still kind of vague on that whole thing, sorry Mike...)
At this moment, it's a completely unnecessary nice-to-have - and it might not even be nice, depending on how freaked out my end-users would be at having this thing pop up in their face when they started typing...
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.
Aha, okay - I'll give that a shot.
Thanks, Mike!
I mean - "Mikes" ;)