Mike last question of the week.
My dynamically generated Ultragrid uses an UltraTextEditor with two buttons added(one left, one right) in various cells of the first column as basically a row group label control.
I have this working great and add the editor to the cells like so.
UltraGrid1.Rows(0).Cells(0).EditorComponent = textEditor
Then I try and set the text value on the editor - according to other posts the cell ignores thisor the cell value on the field - and I get the correct string value in the field, but the row has the "Edit" pencil out to the left, my control with the two buttons is gone, and I just have a string value in the cell using the regular editor.
I have tried several ways to set the value. First, setting the textEditor.Text field but this does not get picked up by the cell, secondly, setting the textEditor.Value field, thirdly, setting the cell value after setting the editor.UltraGrid1.Rows(0).Cells(0).Value = I just get the string value and my editor control goes away, fourth I have tried to set the editor value UltraGrid1.Rows(CountRows).Cells(0).Editor.Value and I get an object reference not set to an instance of the object error
Would I need seperate controls for each instance as the text value of the control will differ with each row, i.e. Day 0, Day 1, etc.and the control can only have one instance of its text property? Secondly, what is the syntax to get this Button"TextValue"Button in my control at the cell level, not the column level, or getting the cells value to show in the text part of the editor by default when I assign the editor to the cell, or Column, because I can do this on the column level too, and actually started this way, and then was just going to hide the cell or the control where the value = "".
Hi,
I'm having a really hard time understanding what you are trying to do here and what the problem is.
wolfcoop3 said: I have this working great and add the editor to the cells like so. UltraGrid1.Rows(0).Cells(0).EditorComponent = textEditor
Are you applying different editors to each cell? If not, then you should use the EditorComponent property on the column rather than the individual cells.
Setting the Value or Text of the UltraTextEditor cannot possibly have any effect on the grid. That would not make sense - which cell would you be updating?
The grid doesn't use the Control itself. The editor control simply provides a copy of it's own internal editor to the grid.
If you want to set a value for a grid cell, then you have to set it through the grid, you can't do it through an editor.
I can't see any reason why setting the Value of a grid cell would cause the editor to disappear. And the only reason I can think of why the value would not show up is if the cell is currently in edit mode and the value is not getting passed up to the TextBox that is displayed over the grid for editing. If that's what you are trying to do, you probably need to take the cell out of edit mode first (you can do this using PerformAction) or maybe you need to set the Text on the TextBox provided by the editor.
Sorry for not making myself clear. At this point we are going to go with a different solution, because it seems like an inordinate amount of work to get the Ultragrid to do what we want. The earlier version that is unbound was much easier to actually work with in the situation where we have to build the grid from a definition source on the fly, and then load with data after the grid has been built Rows X Column dimensions, editor controls added to correct locations, and then data added to those controls.
The Editor control, an ultra text editor contains a button left and a button right. I assign the editor to individual cells in a column because the editor instance does not appear for every row, but happens about every 3rd or 4th row of the grid depending on how many rows make up a Node.
I can add this editor, which is not really functioning as an editor, because the value displayed is not editable and is acting more like a label in between my two buttons, and says things like Day 0, Day 1, Day 2 etc.
This is done in the first column of the grid and then there are named value pairs arranged in any number of rows to the right of this column. Clicking the first button causes the rows to collapse or expand and shows the button image from a + to a - and I show and hide the rows mimmicking expand collapse functionality.
The problem is that if I have no value in the cell I get [button] [button] in my cell which is fine that is my editor control with two buttons. When I assign a value to the cell I only see the string value, and my two buttons that are set to show all the time are no longer there. If I go to edit the text or type in the cell I am typing in a regular cell text box, and my editor is not there.
What I am trying to do is assign an editor to specific cells, have that editor show in read only mode the cell value along with the two buttons I have added to the editor.[button]SomeText[button] and I can not get that to happen. Again I have assigned the text property of the editor, the value property of the editor, the value of the Row.Column, the value of the Cell, and I can not get the text property to show in the control, and Again there will be no updating to this value as it is read only.
I mean I guess I can just use a Label control as long as I can add buttons to the left and right of it. Can I do that or can I only add buttons to editors?
At this point it is mute though as we have decided as a company to move in a different direction since the ultragrid does not support column spanning horizontally. Thank you for all of your time and energy.
wolfcoop3 said:The problem is that if I have no value in the cell I get [button] [button] in my cell which is fine that is my editor control with two buttons. When I assign a value to the cell I only see the string value, and my two buttons that are set to show all the time are no longer there. If I go to edit the text or type in the cell I am typing in a regular cell text box, and my editor is not there.
As I said above, there is no reason why setting the Value on a cell should cause the editor to disappear. So how are you setting the Value?
wolfcoop3 said:Again I have assigned the text property of the editor, the value property of the editor, the value of the Row.Column, the value of the Cell, and I can not get the text property to show in the control, and Again there will be no updating to this value as it is read only.
The only way to set the value in a grid cell is to set the Value property on the cell. None of the other things you mention here will work.