Hi
I have a grid where i wish to use the '-' key to toggel between two cells.
When i press the '-' key, i tell the cell which i am moving to, to have the same value as the previous cell. So cell 1 has the value 500, I press the '-' key and I want cell 2 to have the value of 500 also.
After i set the cells value, i then want to enter edit mode in the cell. I can do this but as soon as i enter edit mode the cells appearance shows the cell as blank.
Is there anyway that i can enter the cells edit mode without it clearing the display contents? (Interestingly enough i have a row in the grid which looks at the totals and it knows that the cell has the value 500 but you just cant see it, when you exit edit mode for that cells the value appears)
grid.ActiveCell = debitCell;
debitCell.Value = creditValue;
grid.PerformAction(
UltraGridAction.EnterEditMode);
grid.ActiveCell.SelStart = 0;
Not sure what happend to the presentation there
debitcell.Value = creditValue;
grid.PerformAction(UltraGridAction.EnterEditMode);
What event are you using to trap for the '-' key? If you are using KeyDown, perhaps the KeyUp is getting triggered after you have entered edit mode and thus clearing the text in the cell.
Also, if you check the Value of the cell after it enters edit mode, is it correct? Or is it null? To test this, I would use a Click Event of some control that doesn't take focus, like a label. That way you can be sure you are testing it after the cell has already entered edit mode without taking it out of edit mode.
The value of the cell is correct, but the text property is blank. I am using the key down event so i shall try the key up or key press instead.
If you click off the cell without typing anything in it then the text property is set, its just the text doesnt actually appear but the value is there!
Actually the value and text property are both set corerctly to 500 when i am debugging, after i have entered edit mode for the cell. Just when the grid appears nothing is in the cell (however the value is correct as i am addign the totals for the columns into another area and these totals are correct)
So this is the KeyDown event of the grid? Or are you trapping it on some other control?
It sounds like what's happening is that the cell is okay, but that something you are doing is interfering with it entering edit mode. What happens in a normal grid cell is that when it enters edit mode, the editor will display an inbox TextBox control over the cell to allow editing. So from your description, it sounds like the grid is either not copying the text from the cell into the TextBox (which seems very unlikely) or that something in your code is clearing the text after the grid has already populated it.
Perhaps the text is actually there but is scrolled out of view to the left or up?