Katalogerna
PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


GTP.NET FAQ 10813


Is it possible to cancel OnGridCellChanged events? Please note that this article refers to the GTP.NET
Jump to article- 2007-02-16 14:52:00 - Email plexityHide

Question

I am using C#, Windows application.
Is it possible to cancel OnGridCellSelectChanged events?
I have a popup form that says do you wish to change yes/no, is there a way to cancel this event?

CODE:

private void gantt1_OnGridCellSelectChanged(Cell cell, CellSelectChangedEventArgs cellSelectChanged)
{
  bool temp;
  submitcancel SCForm = new submitcancel();
  SCForm.ShowDialog();
  temp = SCForm.getStatus();

  if(temp) {
    //continue}
  else {
    //ignore event

  }

}

Answer

The event fires when changes occur in the Selected property of the Cell. So in princip you will get one call when the first cell is unselected and another call when the new cell is selected.

To null out the action here you can simply toggle the Select value back; cell.Selected = ! cellSelectChanged.NowSelected //( possible recursive problem?)

But I think that you want to make sure that the Grid.GridStructure.FocusedCell is not changed, so something like this:

    private void grid1_OnBeforeFocusedCellChange(PlexityHide.GTP.Grid grid, BeforeFocusedCellChangeEventArgs beforeFocusChange)
    {
      // This event allows you do control when cells are focused (when user moves with click or arrow keys)
      if (beforeFocusChange.OldFocusedCell!=null && beforeFocusChange.NewFocusedCell!=null)
      {
        if (beforeFocusChange.OldFocusedCell.Column.Index==2 && beforeFocusChange.NewFocusedCell.Column.Index==1)
        {
          // For some reason I do want the user to be able to move backwards from cell2 to cell1 horizontally
          beforeFocusChange.NewFocusedCell=beforeFocusChange.OldFocusedCell;
        }
      }
    }

 

 

Google
WWW plexityHide GTP.NET FAQ
Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ general

Testimonials

"This is too GREAT. I must say you have strong support and really good programmers at your place. Your entire team is good. Just Fantastic! – 100%"
Gaurav Patole,
WebTechDevelopers
More testimonials...