I am trying to for focus over to another grid on a Winform, my code below get hit but I can't seem to escape the clutches of the current grid. The code to focus gets hit, but I still in the igDet grid. I've tried a dozen variations, all result in the cursor in the current grid igDet. The grids are in a panel. I also have tried the beforeRowInsert as well, grid will not lose it's death grip. After 4 hours of random tries, I I would really love to move on the implementing the business rule itself instead of fighting control behavior (sigh)...Help me Obi Wan Kanobi!
private void igDet_AfterExitEditMode(object sender, EventArgs e)
{
if (this.IsInBaseAction == false )
if ((string)igDet.ActiveCell.Column.Key == "bdsection")
int TotalQty;
TotalQty = moData.Details.Query("1=1").Aggregate<int>("bdqty", AggregateType.Sum).Coalesce(0);
if (TotalQty == moData.CurrentBomMast.BmQty)
this.tscMain.ActiveControl = igAlloc;
igAlloc.Focus();
this.igAlloc.ActiveRow = this.igAlloc.Rows[0];
this.igAlloc.ActiveCell = this.igAlloc.Rows[0].Cells["BaQty"];
this.igAlloc.PerformAction(UltraGridAction.EnterEditMode, false, false);
}
And this don't work either:
private void igDet_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
this.SelectNextControl(igDet, true, true, false, false);
Hi,
Just to add to what Brian posted, using AfterExitEditMode for this seems like a very odd choice. The cell can exit edit mode for a wide variety of reasons. For example, suppose the user edits a cell and then clicks on some other control on the form, like a Button. The button will get clicked and then focus will shift away from the button to another grid.
Or... suppose they click on the second grid. You will end up ripping focus away from whatever cell they clicked on and putting it somewhere else.