Problem on start edit cell by code!

Sep 3, 2009 at 1:57 PM

 

Hi, I'm having some problems to start editing a cell by code. I have my grid cells defined as

SourceGrid.Cells.Views.Cell _CellView = new SourceGrid.Cells.Views.Cell ( );
_CellView.BackColor = _RowBackgroundColor;
_CellView.ForeColor = _RowForegroundColor;

SourceGrid.Cells.Cell _Cell = new SourceGrid.Cells.Cell ( _dr [ _C ].ToString ( ), typeof ( string ) );
_Cell.View = _CellView;
_Cell.Editor.AllowNull = this.ColumnInfo [ _C ].allowNull;
this [ _L, _C ] = _Cell;
this [ _L, _C ].Editor.EnableEdit = this.EnableEdit && !this.ColumnInfo [ _C ].readOnly;
this [ _L, _C ].ToolTipText = this [ _L, _C ].DisplayText;
this [ _L, _C ].AddController ( _ToolTipController );
this [ _L, _C ].Editor.UseCellViewProperties = false;

and to set de cell mode to edit I use the following method

public void StartEdit ( SourceGrid.Position Position )
{
SourceGrid.CellContext _Context = new SourceGrid.CellContext ( this, Position, this [ Position.Row, Position.Column ] );
_Context.StartEdit ( );
}

which apparently does nothing once I invoke it (e.g. this.grid.StartEdit ( 1, 0 );).

Can anyone shed some light on why nothing is happening and/or how to make it work?

Thanks.

 

Coordinator
Sep 6, 2009 at 8:47 AM

Hi, zemira.

 

I've tested your code, and it works fine. Probably, your Editor.EnableEdit property is set to false.

 

I have also commited a sample of how to start edit programatically. Check out the new code and see example number 54.

 

 

Sep 7, 2009 at 3:17 PM

Hi. Thanks for the reply. Nonetheless I found out what I was doing wrong: on the test app I am using I was calling the StartEdit method from the form Load event handler. For testing purposes I moved the call to the StartEdit method to the form's Activated event handler and everything worked as expected.

Tanks.