hi everybody, i hope somebody help me, i need to do a user control that i can see it in a ultrawingrid, i saw an example with the ricthTextEditor, but i would like read documentation about that task!!!! in fact i need a user control with the ultrawincombo's features embebed in a ultragridcell that i can type in the combo's head
Hi,
In order to truly embed a control in a grid cell, you would need to implement an EmbeddableEditorBase. This is not a trivial task and if you take a look at the code for the RichTextEditor sample, you can see it requires quite a bit of code. Even an experienced developer can takes days or even weeks writing an editor. So I would advise against it unless you can't acheive what you want any other way.
A very easy alternative is to create a custom dropdown in the grid. You can use an UltraTextEditor control and add a DropDownEditorButton to it's ButtonsRight collection, and then assign any control you want (like a UserControl) to the Control property of the button. This will create an instant dropdown with the control ovf your choice and you can assign this UltraTextEditor as the EditorControl of the grid column to provide a custom dropdown in the grid. You then handle a few events to control what happens when you drop down or close up the combo.
thanks a lot for the answer, but i want to create a user control that Inherits ultrawincombo and let me insert it in an ultragridcell of an ultrawingrid.
This is technically possible. You can derive a class from UltraCombo and then assign the EditorControl of a grid column or cell to the derived control. But this probably won't do what you want. The grid doesn't really use the control you give it. What happens with an editor control is that the control implements to IProvidesEmbeddableEditor interface. This interface as only one property which returns an EmbeddableEditorBase. This is a clone of the control's internal editor which the control hands out for use by the grid. So so properties on he control will affect this cloned editor, if you set the property before you assign the EditorControl property of the column. But things like events will not fire on the derived control when the user does things in the grid, because the grid is not using the control.
So whether or not this is viable really depends on why you are deriving your own control and what you want it to do in the grid.
Hi Marco,
You are probably right. My guess is that this is a side effect of that fact that UltraCombo existed as a control before support for Embeddable Editors was implemented in the grid. So it was retro-fitted and made into an editor later. So it might behave a little differently than some of the other editors.
Really, using an EditorControl for a grid column is not the best way to do things in any case. This functionality was implemented as a convenience and to allow you to set the editor on a column at design-time. But creating a control to provide an editor to a column is actually a bit wasteful, since the control itself uses up memory for no reason. The more efficient way to do it is to simply create an Editor of the appropriate type at run time and assign it to the Editor property of the column. This is actually what the EditorControl property does, anyway. It just take the Editor property provided by the EditorControl and uses the editor provided as the Editor of the column.
Hi Mike
I just found your above reply while looking for some information about the Editor property of the UltraCombo implementing the IProvidesEmbeddableEditor. What you state seems perfectly ok for all of the other IProvidesEmbeddableEditor inheritors, but the UltraCombo seems to behave in a slightly different way (correct me if I'm wrong):
when I use the Editor property (which is private on the UltraCombo?, but accessible by explicitly casting the UltraCombo to an IProvidesEmbeddableEditor?), I get an UltraGridComboEditor, which I assign to the Editor property of an UltraGridColumn, then the UltraCombo events fire nevertheless (e.g. the OnBeforeDropDown) after the corresponding events on the EmbeddableEditor. In contrast to the other IProvidesEmbeddableEditor inheritors, the UltraGridComboEditor off the UltraCombo's Editor property seems to be closely linked to it's UltraCombo. Is there an explanation for that, or am I completely wrong? The goal would be to obtain an independent EmbeddableEditor not being linked to the UltraCombo, like with the UltraTextEditor or the UltraCalculatorDropDown.
The reason to use the embeddable editor and not the UltraDropDown/ValueList alternative is that I am using a DataFilter with the editor.
Thanks in advance for any information on that topic.
Marco