public virtual void OnFocusLeaving(PositionCancelEventArgs e) { for (int i = 0; i < m_SubModels.Count; i++) { m_SubModels[i].OnFocusLeaving(e); } }
/// <summary> /// Fired when the EndEdit is called. You can read the Cancel property to determine if the edit is completed. If you change the cancel property there is no effect. /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public virtual void OnEditEnded(PositionCancelEventArgs e) { for (int i = 0; i < behaviorModels.Count; i++) { behaviorModels[i].OnEditEnded(e); } }
public void OnFocusEntering(PositionCancelEventArgs e) { if (FocusEntering != null) { FocusEntering(this, e); } }
/// <summary> /// Fired when the focus is entering in the specified cell. You can put the e.Cancel = true to cancel the focus operation. /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public virtual void OnFocusEntering(PositionCancelEventArgs e) { for (int i = 0; i < behaviorModels.Count; i++) { behaviorModels[i].OnFocusEntering(e); } }
public override void OnEditEnded(PositionCancelEventArgs e) { base.OnEditEnded(e); ImportsGrid g = (ImportsGrid)e.Grid; g.CommitEdit(e); }
public virtual void OnEditStarting(PositionCancelEventArgs e) { if (EditStarting != null) { EditStarting(this, e); } }
public virtual void OnEditEnded(PositionCancelEventArgs e) { if (EditEnded != null) { EditEnded(this, e); } }
/// <summary> /// Fires the edit starting event in a specified cell /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public virtual void OnEditStarting(PositionCancelEventArgs e) { for (int i = 0; i < subModels.Count; i++) { subModels[i].OnEditStarting(e); } }
/// <summary> /// Handles the focus entering event in the specified cell /// </summary> /// <param name="e">The cell position</param> public override void OnFocusEntering(PositionCancelEventArgs e) { Cells.Real.Cell cell = e.Cell as Cells.Real.Cell; if (cell != null && cell.ExpandedCell == true) { e.Cancel = true; } }
public override void OnFocusEntering(PositionCancelEventArgs e) { // check whether the user is in a resize region if (resize != null && resize.IsHeightResizing == false && resize.IsWidthResizing == false && e.Grid.Selection.SelectionMode != GridSelectionMode.Column) { e.Grid.Rows[e.Position.Row].Focus(); e.Grid.Rows[e.Position.Row].Select = false; } base.OnFocusEntering(e); }
/// <summary> /// Start the edit operation with the current editor specified in the Model property. /// </summary> /// <param name="position">The position.</param> /// <param name="p_NewStartEditValue">The value that the editor receive</param> public virtual void StartEdit(Position position, object p_NewStartEditValue) { if (this.ownerGrid != null && this.cellModel != null && IsEditing(position) == false && //se la cella non è già in stato edit this.cellModel.EnableEdit == true && this.ownerGrid.SetFocusCell(position)) //per finire eventuali altri edit e posizionare il focus su questa cella { PositionCancelEventArgs l_EventArgs = new PositionCancelEventArgs(position, this); OnEditStarting(l_EventArgs); if (l_EventArgs.Cancel == false) { this.cellModel.InternalStartEdit(this, position, p_NewStartEditValue); } } }
public override void OnFocusEntering(PositionCancelEventArgs e) { //check if the user is in a resize region if (m_Resize != null && m_Resize.IsHeightResizing == false && m_Resize.IsWidthResizing == false && IsSortEnable(e) == false && e.Grid.Selection.SelectionMode != GridSelectionMode.Row) { //if the sort is disable I use the header as a column selector e.Grid.Columns[e.Position.Column].Focus(); e.Grid.Columns[e.Position.Column].Select = true; } base.OnFocusEntering(e); }
/// <summary> /// Terminate the edit operation /// </summary> /// <param name="isCancelled">If true undo all the changes</param> /// <returns> /// Returns true if the edit operation is successfully terminated, otherwise false /// </returns> public bool EndEdit(bool isCancelled) { if (this.cellModel == null || !this.cellModel.IsEditing) { return(true); } Position l_Position = this.cellModel.EditPosition; bool l_Success = this.cellModel.InternalEndEdit(isCancelled); if (l_Success) { PositionCancelEventArgs eventArgs = new PositionCancelEventArgs(l_Position, this); eventArgs.Cancel = isCancelled; OnEditEnded(eventArgs); } return(l_Success); }
/// <summary> /// Terminate the edit operation /// </summary> /// <param name="p_bCancel">If true undo all the changes</param> /// <returns>Returns true if the edit operation is successfully terminated, otherwise false</returns> public bool EndEdit(bool p_bCancel) { if (m_CellModel != null && m_CellModel.IsEditing) { Position l_Position = m_CellModel.EditPosition; bool l_Success = m_CellModel.InternalEndEdit(p_bCancel); if (l_Success) { PositionCancelEventArgs l_EventArgs = new PositionCancelEventArgs(l_Position, this); l_EventArgs.Cancel = p_bCancel; OnEditEnded(l_EventArgs); } return(l_Success); } else { return(true); } }
/// <summary> /// Fires the focus entering in a specified cell /// </summary> /// <param name="e">The cell position</param> public override void OnFocusEntering(PositionCancelEventArgs e) { base.OnFocusEntering(e); e.Cancel = !CanReceiveFocus; }
/// <summary> /// Change the focus of the grid. /// </summary> /// <param name="p_CellToSetFocus">Must be a valid cell linked to the grid or null of you want to remove the focus</param> /// <param name="p_DeselectOtherCells">True to deselect others selected cells</param> /// <returns> /// Return true if the grid can select the cell specified, otherwise false /// </returns> /// <remarks> /// The call order is: /// (the user select CellX) /// CellX.FocusEntering /// Grid.CellGotFocus(CellX), /// CellX.FocusEntered, /// (the user select CellY), /// CellY.FocusEntering /// CellX.FocusLeaving /// Grid.CellLostFocus(CellX), /// CellX.FocusLeft, /// Grid.CellGotFocus(CellY), /// CellY.FocusEntered /// </remarks> public virtual bool SetFocusCell(Position p_CellToSetFocus, bool p_DeselectOtherCells) { if (p_CellToSetFocus == FocusCellPosition || (p_CellToSetFocus.Column != FocusCellPosition.Column && p_CellToSetFocus.Row == FocusCellPosition.Row && Selection.SelectionMode == GridSelectionMode.Row)) { // put anyway the focus on the cells if (p_CellToSetFocus.IsEmpty() == false) { SetFocusOnCells(); } if (FocusCellPosition.IsEmpty() == false && GetCell(FocusCellPosition) != null) { PositionCancelEventArgs l_OldEventArg = new PositionCancelEventArgs(FocusCellPosition, GetCell(FocusCellPosition)); l_OldEventArg.Cell.OnFocusLeaving(l_OldEventArg); if (l_OldEventArg.Cancel) { return false; } OnCellLostFocus(l_OldEventArg); if (l_OldEventArg.Cancel) { return false; } } // deselect old selected cells if (p_DeselectOtherCells) { Selection.Clear(); } } else // if (p_CellToSetFocus != FocusCellPosition || (p_CellToSetFocus.Column==FocusCellPosition.Column || p_CellToSetFocus.Row!=FocusCellPosition.Row || Selection.SelectionMode==GridSelectionMode.Row) ) // { // New Focus Cell Entering ICellVirtual l_CellToFocus = GetCell(p_CellToSetFocus); PositionCancelEventArgs l_NewEventArg = new PositionCancelEventArgs(p_CellToSetFocus, l_CellToFocus); if (p_CellToSetFocus.IsEmpty() == false && l_CellToFocus != null) { l_CellToFocus.OnFocusEntering(l_NewEventArg); if (l_NewEventArg.Cancel) { return false; } } if (l_CellToFocus != null && l_CellToFocus.CanReceiveFocus == false) { return false; } // Old Focus Cell Leaving and Left if (FocusCellPosition.IsEmpty() == false && GetCell(FocusCellPosition) != null) { PositionCancelEventArgs l_OldEventArg = new PositionCancelEventArgs(FocusCellPosition, GetCell(FocusCellPosition)); l_OldEventArg.Cell.OnFocusLeaving(l_OldEventArg); if (l_OldEventArg.Cancel) { return false; } OnCellLostFocus(l_OldEventArg); if (l_OldEventArg.Cancel) { return false; } } // Deselect Old Cells if (p_DeselectOtherCells) { Selection.Clear(); } // New Focus Cell Entered if (p_CellToSetFocus.IsEmpty() == false && l_CellToFocus != null) { OnCellGotFocus(l_NewEventArg); return !l_NewEventArg.Cancel; } } return true; }
/// <summary> /// Fired when a cell receive the focus /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> protected virtual void OnCellGotFocus(PositionCancelEventArgs e) { if (e.Cancel) { return; } // Event Got Focus if (cellGotFocus != null) { cellGotFocus(this, e); } if (e.Cancel) { return; } ////e.Cancel = !SetFocusOnCells(); ////if (e.Cancel) ////{ //// return; ////} SetFocusOnCells(); this.focusPosition = e.Position; e.Cell.OnFocusEntered(e); }
//// public override void OnMouseEnter(PositionEventArgs e) //// { //// base.OnMouseEnter(e); //// //// e.Cell.Invalidate(e.Position);//Invalidate the cell to refresh the box //// } //// //// public override void OnMouseLeave(PositionEventArgs e) //// { //// base.OnMouseLeave(e); //// //// e.Cell.Invalidate(e.Position);//Invalidate the cell to refresh the box //// } /// <summary> /// Handles the focus entering event in the current cell. This type of cell can't receive the focus /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public override void OnFocusEntering(PositionCancelEventArgs e) { e.Cancel = true; }
/// <summary> /// Terminate the edit operation /// </summary> /// <param name="isCancelled">If true undo all the changes</param> /// <returns> /// Returns true if the edit operation is successfully terminated, otherwise false /// </returns> public bool EndEdit(bool isCancelled) { if (this.cellModel == null || !this.cellModel.IsEditing) { return true; } Position l_Position = this.cellModel.EditPosition; bool l_Success = this.cellModel.InternalEndEdit(isCancelled); if (l_Success) { PositionCancelEventArgs eventArgs = new PositionCancelEventArgs(l_Position, this); eventArgs.Cancel = isCancelled; OnEditEnded(eventArgs); } return l_Success; }
/// <summary> /// Fires the focus leaving event /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public void OnFocusLeaving(PositionCancelEventArgs e) { if (FocusLeaving != null) { FocusLeaving(this, e); } }
/// <summary> /// Fired before the cell leave the focus, you can put the e.Cancel = true to cancel the leave operation. /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public virtual void OnFocusLeaving(PositionCancelEventArgs e) { for (int i = 0; i < behaviorModels.Count; i++) { behaviorModels[i].OnFocusLeaving(e); } }
/// <summary> /// Fires the edit starting in a specified cell /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public virtual void OnEditStarting(PositionCancelEventArgs e) { if (EditStarting != null) { EditStarting(this, e); } }
/// <summary> /// Fires the edit ended event in a specified cell /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public virtual void OnEditEnded(PositionCancelEventArgs e) { if (EditEnded != null) { EditEnded(this, e); } }
/// <summary> /// MouseDown event /// </summary> /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param> public virtual void OnGridMouseDown(MouseEventArgs e) { if (mouseDown != null) { mouseDown(this, e); } if (FocusCellPosition.IsEmpty() == false) { ICellVirtual l_FocusCell = GetCell(FocusCellPosition); if (l_FocusCell != null && l_FocusCell.IsEditing(FocusCellPosition)) { if (l_FocusCell.EndEdit(false) == false) { return; } } } Position l_Position = PositionAtPoint(new Point(e.X, e.Y)); if (l_Position.IsEmpty() == false) { ICellVirtual l_CellMouseDown = GetCell(l_Position); if (l_CellMouseDown != null) { ChangeMouseDownCell(l_Position, l_Position); // Cell.OnMouseDown PositionMouseEventArgs l_EventArgs = new PositionMouseEventArgs(l_Position, l_CellMouseDown, e); l_CellMouseDown.OnMouseDown(l_EventArgs); if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift && e.Button == MouseButtons.Left) // && Selection.EnableMultiSelection) { // New Focus Cell Entering ICellVirtual l_CellToFocus = GetCell(mouseDownPosition); PositionCancelEventArgs l_NewEventArg = new PositionCancelEventArgs(mouseDownPosition, l_CellToFocus); l_CellToFocus.OnFocusEntering(l_NewEventArg); if (!l_NewEventArg.Cancel) { Selection.Clear(FocusCellPosition); if (!FocusCellPosition.IsEmpty()) { int start = Math.Min(FocusCellPosition.Row, MouseDownPosition.Row); int end = Math.Max(FocusCellPosition.Row, MouseDownPosition.Row); Selection.AddRange(new Range(start, MouseDownPosition.Column, end, MouseDownPosition.Column)); SetFocusCell(mouseDownPosition, false); OnUserSelection(new UserSelectionEventArgs(selection)); } } } else if ((Control.ModifierKeys & Keys.Control) == Keys.Control && e.Button == MouseButtons.Left && Selection.EnableMultiSelection) { // New Focus Cell Entering ICellVirtual l_CellToFocus = GetCell(mouseDownPosition); PositionCancelEventArgs l_NewEventArg = new PositionCancelEventArgs(mouseDownPosition, l_CellToFocus); l_CellToFocus.OnFocusEntering(l_NewEventArg); if (!l_NewEventArg.Cancel) { if (Selection.Contains(mouseDownPosition) == false) { Selection.Add(mouseDownPosition); SetFocusCell(mouseDownPosition, false); OnUserSelection(new UserSelectionEventArgs(selection)); } else { if (mouseDownPosition.Row == FocusCellPosition.Row) { PositionCancelEventArgs l_OldEventArg = new PositionCancelEventArgs(FocusCellPosition, GetCell(FocusCellPosition)); l_OldEventArg.Cell.OnFocusLeaving(l_OldEventArg); OnCellLostFocus(l_OldEventArg); } Selection.Remove(mouseDownPosition); OnUserSelection(new UserSelectionEventArgs(selection)); } } } else if (e.Button == MouseButtons.Right) { contextMenuCellPosition = new Position(mouseDownPosition.Row, mouseDownPosition.Column); //// The following code would cause the right-click to additionally //// set the focus cell to the cell under the cursor and also //// add the focus cell/row to te current selection. ////ICellVirtual l_CellToFocus = GetCell(mouseDownPosition); ////if (mouseDownPosition.IsEmpty() == false && l_CellToFocus != null) ////{ //// PositionCancelEventArgs l_NewEventArg = new PositionCancelEventArgs(mouseDownPosition, l_CellToFocus); //// l_CellToFocus.OnFocusEntering(l_NewEventArg); //// if (!l_NewEventArg.Cancel) //// { //// SetFocusCell(mouseDownPosition, false); //// } ////} ////else ////{ //// SetFocusCell(mouseDownPosition, false); // focus permet d'annuler certains evenements ////} } else if (Selection.Contains(mouseDownPosition) == false || e.Button == MouseButtons.Left) { // New Focus Cell Entering ICellVirtual l_CellToFocus = GetCell(mouseDownPosition); if (mouseDownPosition.IsEmpty() == false && l_CellToFocus != null) { PositionCancelEventArgs l_NewEventArg = new PositionCancelEventArgs(mouseDownPosition, l_CellToFocus); l_CellToFocus.OnFocusEntering(l_NewEventArg); if (!l_NewEventArg.Cancel) { SetFocusCell(Position.Empty); Selection.Clear(); Selection.Add(mouseDownPosition); SetFocusCell(mouseDownPosition, true); OnUserSelection(new UserSelectionEventArgs(selection)); } } else { SetFocusCell(mouseDownPosition, false); // focus permet d'annuler certains evenements } } } } else { ChangeMouseDownCell(Position.Empty, Position.Empty); } }
/// <summary> /// Fires the focus entering in a specified cell /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public virtual void OnFocusEntering(PositionCancelEventArgs e) { for (int i = 0; i < subModels.Count; i++) { subModels[i].OnFocusEntering(e); } }
/// <summary> /// Fired when a cell lost the focus /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public virtual void OnCellLostFocus(PositionCancelEventArgs e) { if (e.Cancel) { return; } bool l_FocusContainer = true; if (ContainsFocus) { l_FocusContainer = SetFocusOnCells(); } e.Cancel = l_FocusContainer && e.Cell.EndEdit(false) == false; if (e.Cancel) { return; } //event Lost Focus if (cellLostFocus != null) { cellLostFocus(this, e); } if (e.Cancel) { return; } this.focusPosition = Position.Empty; e.Cell.OnFocusLeft(e); }
/// <summary> /// Fires the focus entering in a specified cell /// </summary> /// <param name="e">The <see cref="Fr.Medit.MedDataGrid.PositionCancelEventArgs"/> instance containing the event data.</param> public override void OnFocusEntering(PositionCancelEventArgs e) { // check whether the user is in a resize region if (resize != null && resize.IsHeightResizing == false && resize.IsWidthResizing == false && IsSortEnable(e) == false && e.Grid.Selection.SelectionMode != GridSelectionMode.Row) { // if the sort is disabled use the header as a column selector e.Grid.Columns[e.Position.Column].Focus(); e.Grid.Columns[e.Position.Column].Select = true; } base.OnFocusEntering(e); }