Hi,
I have ultragrid with ultraTextEditor using ultraControlContainerEditor1.
I want to capture the ultraTextEditor text as soon as user type in it, in short every key stroke with in the ultraTextEditor.
I tried to do this using ultraGrid1_CellChange event , but it is not triggering at all for any cell I change the value.
So... if you ONLY want the color to change when the user is typing (the cell is in edit mode and the UltraTextEditor has focus), then it seems to me that you could handle that inside the UserControl code itself. You could trap the TexttChanged event of the UltraTextEditor and handle it right there.
If you want the text to be red when the user types something invalid OR when the text of a cell is invalid even when it's not in edit mode, then what I would do is take the sample I send you and simply re-factor the code from InitializeRow into a helper method. Then you would call that same method from InitializeRow (for cells not in edit mode) and also from CellChange (so that the same code is triggered when the user types in the cell).
EDIT: It looks like that second approach doesn't work. Applying an Appearance to the cell while it's in edit mode doesn't re-apply the appearance to the EditingControl. So you would have to do a little bit more work there.
I updated the sample once again to force the EditingControl to update immediately as you type.
8524.TextEditorInGridCaptureTextONntering Sample01.zip
Lizzy De said:I wanted whenever user type some specific letters , the forcolor of ultraTextEditor should be RED otherwise BLACK.
I mean while typing itself the forecolor should change according to condition.
Mike Saltzman said:I'm still not sure what you are trying to do. Can you please clarify exactly what you want to achieve here?
I wanted whenever user type some specific letters , the forcolor of ultraTextEditor should be RED otherwise BLACK.
Mike Saltzman said:The code you have here will do nothing, because ApplyOwnerAppearanceToEditingControl and ApplyOwnerAppearanceToRenderingControl default to true. So this code is a no-op that just sets these properties to the values they already have.
got it
Mike Saltzman said:You have some really strange code in here that I don't understand in the UltraGrid1_CellChange. I can't see how exiting edit mode inside this event makes any sense. You would end up leaving edit mode as soon as the user typed any single character, so I am baffled as to what you were trying to do there.
CellChange event is used to list the user typed letters with some condition.
I'm still not sure what you are trying to do. Can you please clarify exactly what you want to achieve here?
The code you have here will do nothing, because ApplyOwnerAppearanceToEditingControl and ApplyOwnerAppearanceToRenderingControl default to true. So this code is a no-op that just sets these properties to the values they already have.
You have some really strange code in here that I don't understand in the UltraGrid1_CellChange. I can't see how exiting edit mode inside this event makes any sense. You would end up leaving edit mode as soon as the user typed any single character, so I am baffled as to what you were trying to do there.
Your InitializeRow code makes sense. And I can see that you are applying an appearance to the cells of the grid. That's good. These appearance settings will get applied to the EditingControl and the RenderingControl. But keep in mind that your EditingControl is the UserControl (utc1 and utc2). So if you were to set the BackColor of the cell, that would work since the majority of the cell is showing the UserControl's background. But setting the ForeColor on the UserControl will not affect the ForeColor of the TextBox (or UltraTextEditor) inside the UserControl. I see that you also added code to change the ForeColor of the UtraTextEditor of the UserControl, but the code was commented out. That's the right thing to do, but InitializeRow is the wrong place to do it, since the RenderingControl and EditingControl are shared amongst all the cells in the column. So that's where the ApplyOwnerAppearance comes in.
I have attached an updated sample here the works.
So the first thing I did here was remove the CellChange event code, because I just don't get what you were trying to do there. I changed InitializeRow to set (or reset) the ForeColor and BackColor of the cell based on the value. Note that it's always a good idea to set BOTH ForeColor and BackColor. If you set one without the other, you run the risk of setting the, both to the same color and then the user can't see the text.
I ALSO set the SelectedAppearance and ActiveAppearance on the cells. If you don't do this, then when you run the sample, you will not see the colors applied to the first row cell(s), because the active appearance (the white-on-blue windows highlight colors) will override the cell settings.
Finally, I overrode ApplyOwnerAppearance on the ControlContainerEditor. There, I get the resolved appearance settings and apply them to the UltraTextEditor inside the UserControl.
TextEditorInGridCaptureTextONntering Sample01.zip
Hi Mike,
My requirment required particular forecolor for the user input, I tried the suggested options in the following sample:
https://drive.google.com/file/d/1m_e54uwWTlrB1VVhB6scJ1MDS9FFXp1N/view?usp=sharing
myControlContainerEditor.ApplyOwnerAppearanceToEditingControl = true; myControlContainerEditor.ApplyOwnerAppearanceToRenderingControl = true;
I am not getting the required output, might be my way to approach the suggestions is not in correct way.