I'm using an UltraComboEditor as my EditorComponent for a particular column in my UltraGrid,
I added a DropDownEditorButton to the ButtonsRight collection of the UltraComboEditor
(the control the DropDownEditor is associated to, happens to be is an UltraGrid, but I don't think it should matter)
I'd like when the user clicks on the text area of the cell of that particular column, i'd like the the DropDownEditor should drop down.
I tried running this line of code in the grid.CellClick or grid.AfterEnterEditMode or grid.DoubleClickRow
DirectCast(grid.ActiveCell.EditorComponentResolved,UltraComboEditor).ButtonsRight("myBotton").DropDown()
and it keeps throwing this exception:
The associated editor must be in edit mode to be dropped down
I tried preceding any of the following:
grid.PerformAction(EnterEditMode)
or
grid.ActiveCell.EditorResolved.Focus()
grid.ActiveCell.EditorComponentResolved.Focus
same result
any advice would be greatly apprciated
Mendel
Yes, issue resolved, Thanks!
I'm well aware of the ultra combo, but since I needed the Filter UI Row in the grid which cannot be accomplished with an ultra combo [as far as I can tell].
So I hid the drop-down button added my DropDownEditorButton, the user hits this drop-down, then he can filter within inside the grid drop down in any column...it works beautifully...
Hi,
The problem with that you are doing here is this line of code:
mendel_lowy said:DirectCast(grid.ActiveCell.EditorComponentResolved,UltraComboEditor).ButtonsRight("myBotton")
This code is trying to drop down the button on the EditorComponentResolved, which in this case is the UltraComboEditor control on the form, not the cell in the grid.The UltraCombo control on the form is not in edit mode - the grid cell is. The grid does not use the control you assign to the EditorComponent property. What happens is that the editor component (the UltraComboEditor) provides a copy of it's internal editor to the grid.
The correct way to do this would be something like this:
Private Sub UltraGrid1_AfterEnterEditMode(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UltraGrid1.AfterEnterEditMode ' Get the grid Dim grid As UltraGrid = DirectCast(sender, UltraGrid) ' Get the editor from the ActiveCell. Note the use of EditorResolved, not EditorComponentResolved. Dim editor As EmbeddableEditorButtonBase = DirectCast(grid.ActiveCell.EditorResolved, EmbeddableEditorButtonBase) ' We could also use EditorWithCombo, if we wanted, but EmbeddableEditorButtonBase is the base ' type for all editors that support editor buttons. ' 'Dim editor As EditorWithCombo = DirectCast(grid.ActiveCell.EditorResolved, EditorWithCombo) ' Get the dropdown button Dim dropdownButton As DropDownEditorButton = DirectCast(editor.ButtonsRight("myButton"), DropDownEditorButton) ' Drop it down. dropdownButton.DropDown() End Sub
You will need to add some other checks to this code, like checking for the correct column(s) and checking if the ActiveCell is Nothing, but you this is the basic gist of it.
Hello ,
If you want to display a UltraGrid as DropDown of column’s editor I suggest you to use UltraCombo instead. If I am understand you correctly there is no need to add an editor button in ButtonRights collection. Base on description of your scenario I have created a small sample to achieve your goal. Please run the sample and let me know if this is what you are looking for.
I am waiting for your response.