I have been searching the forums, in particular this post, for an answer, but I have missed it. I have also been playing with as many settings and events as I can think of to be relevant, but none have nailed what I need.
The situation: UltraGrid with a column that has an Editor of type UltraTextEditor, which itself has an UltraDropDownButton in its ButtonsRight collection that drops down a custom control.
When the user clicks in the cell (the text portion, not the drop down button portion), it goes into edit mode and the user can type in the text. What I want is to have the drop down button actually drop down as though it were clicked when the user clicks *anywhere* in the cell.
I feel like this is straightforward, but that I am missing something. Please advise.
Thanks,
J
Hi,
Do you want the cell to enter edit mode so the user can type, in addition to automatically dropping down? Or do you want it to act like a DropDownList cell where the user had to pick from the list and cannot type?
Hey Mike,
Sorry for not being more specific, I want it to act like a DropDownList cell where the control in the dropdownbutton drops down no matter where the user clicks. I do not want the cursor to ever activate inside the text.
I have tried column settings for cell activation, click style, style, and others I can't think of. Also, events like BeforeEnterEditMode (can't drop down the control because the editor isn't in edit mode yet), AfterEnterEditMode (doesn't seem to work), and others. I feel like I am just missing it.
This is actually pretty tricky. I don't think this is possible to do with UltraTextEditor. You have to use UltraCombo or UltraComboEditor (EditorWithCombo).
Here's a thread where I posted some sample code to do this:
Disabling keyboard input but allowing drop-down to function - Infragistics Community
Got it done, thanks. I used the combo's BeforeEditorDropDown event to initialize my custom control, the AfterEditorCloseUp event to set the cell value, and had a custom ControlFinished event on my control that I listened to that indicated that the user had clicked OK or Cancel in my control.
Here are my general notes from my code comments, in case it helps anyone else:
Note on dropping down custom user control:
Followed this thread: http://community.infragistics.com/forums/p/23993/88057.aspx#88057
1. Use an EditorWithCombo-derived control (UltraCombo or UltraComboEditor)
2. Turn off the default drop down button for your Combo.
3. Create your own DropDownEditorButton and set its control to your custom control.
4. Add the DropDownEditorButton to the Combo's ButtonsRight (or left) collection.
5. In the grid InitializeLayout, set the relevant column's EditorComponent to be the Combo.
6. Also set the column's Style to DropDownList.
7. Listen to the grid's BeforeCellListDropDown event; cancel the event (it will be an empty list from the Combo) and manually tell your DropDownEditorButton to DropDown().
8. In the Combo's BeforeEditorButtonDropDown event, take the value from the cell and initialize your control (if necessary).
9. In the Combo's AfterEditorButtonCloseUp event, set the value of the cell according to whatever went on in your custom control.
10. Also in the AfterEditorButtonCloseUp event, also BE SURE to add the new value of the cell to the combo's ValueList.ValueListItems collection (or already load all possible values); otherwise, you will get an Infragistics error (when set to DropDownList, Value has to be available in the collection.)
Note: If you want your custom control to be able to close up the drop down (like if it has OK and Cancel buttons, perhaps), then put a public event in your control, subscribe to it here, then in that event handler, manually close up the combo's DropDownEditorButton (which will then fire AfterEditorButtonCloseUp).
Thanks Mike,
could you send me sample code or examples for this process in vb.net