Guy
  • Guy
  • Newbie Topic Starter
2012-12-12T11:20:27Z
Hello,

my application uses a grid with multiple cells. I need a way to trigger the AfterCellCommitEdit event manually. The only thing I can provide is the grid reference itself, however I am missing the public OnCommitEdit() event method. Is it possible to achive this at all?

Thanks very much.
Igor/10Tec
2012-12-12T11:58:47Z
Do you mean the CommitEditCurCell method one can use to finish editing and hence raise the AfterCommitEdit event?

One more not: We have the AfterCommitEdit event (but not AfterCellCommitEdit), and the protected virtual OnAfterCommitEdit method which triggers it.
Guy
  • Guy
  • Newbie Topic Starter
2012-12-12T12:24:04Z
Yes indeed, I meant the AfterCommitEdit event.
I cannot call OnAfterCommitEdit() on cell.Grid as the method is protected.

Example:
I have set the cells value and then need to commit the value, thus needing to raise AfterCellCommitEdit.
This code snippet never raises the AfterCommitEdit event of the Grid.

public void SomeMethod(iGridCell cell, string value)
{
cell.Value = value;
cell.Grid.CommitEditCurCell();
}

Hope this helps you.
Igor/10Tec
2012-12-12T14:29:59Z
AfterCommitEdit is an event related to interactive editing, but it is not raised when you change a cell's value in code. The same concerns the CommitEditCurCell method - it finishes the interactive editing and raises AfterCommitEdit only in this case, but it does nothing if the grid is not in edit mode.

You can call the event handler manually after you have changed cell.Value. If you have an event handler

private void iGrid1_AfterCommitEdit(object sender, TenTec.Windows.iGridLib.iGAfterCommitEditEventArgs e)
{
...
}

, then you can simply call it like this:

iGrid1_AfterCommitEdit(iGrid1, new iGAfterCommitEditEventArgs(cell.RowIndex, cell.ColIndex));

or even this if you do not use the parameter values:

iGrid1_AfterCommitEdit(null, null);

We do not see the whole task, so maybe the solution can differ from this a little bit.
Guy
  • Guy
  • Newbie Topic Starter
2012-12-13T08:30:33Z
Yes I know about the iGrid_AfterCommitEdit event handler and I have off course implemented it. I have a windows form holding the grid and its event handlers. However, as soon as my AfterCommitEdit is raised, it is delegated to two other windows form doing the actual presentation work (and I dont have access to either one from the grid view). Thats why I was wondering if there would be a way to trigger the AfterCommitEdit event manually and thereby doing the actual work in the two forms.

Most of my own events I implement can be triggered via a general ProcessEvent(Enum.EventName) and so I was wondering if something similar would be available in the iGrid. I found a different way to process my data input. I dont really like it, but its doing my work as desired.

Thank you very much IgorK!