/// <summary> /// advance the cursor one column to the right. The advanced to location depends /// if the cursor is located in an input field, if the cursor is at the last /// column of the input field and if it is, whether the code should advance to the /// next input field or to the screen location to the right which is outside the /// input field. /// </summary> /// <param name="HowAdvance"></param> /// <param name="Reuse"></param> /// <returns></returns> public CanvasPositionCursor AdvanceRight(ScreenVisualItems VisualItems, HowAdvance HowAdvance = HowAdvance.NextEntryField, bool Reuse = true) { var cursor = this; if (cursor.IsOutsideVisualItem() == true) { var rowCol = cursor.RowCol.AdvanceRight(); cursor = new CanvasPositionCursor(VisualItems, rowCol as ZeroRowCol); } else { var vi = cursor.GetVisualItem(); var pos = cursor.Position; // cursor located in entry field. and cursor is at the end of the input field. if (((vi as VisualItem)?.IsInputItem == true) && ((vi as VisualItem).IsLastColumn(this.Position))) { if (HowAdvance == HowAdvance.NextEntryField) { cursor = this.NextInputItemCircular(VisualItems, null, Reuse); } } else { if (Reuse == true) { cursor.Position += 1; } else { cursor = new CanvasPositionCursor(this.ItemCursor, this.Position + 1); } } } return(cursor); }
public CanvasPositionCursor AdvanceLeft(ScreenVisualItems VisualItems, HowAdvance HowAdvance = HowAdvance.NextEntryField, bool Reuse = true) { var cursor = this; if (cursor.IsOutsideVisualItem() == true) { var rowCol = cursor.RowCol.AdvanceLeft(); cursor = new CanvasPositionCursor(VisualItems, rowCol as ZeroRowCol); } else { var vi = cursor.GetVisualItem(); var pos = cursor.Position; // cursor located in entry field. and cursor is at the end of the input field. if (((vi as VisualItem)?.IsInputItem == true) && (this.Position == 1) && (HowAdvance == HowAdvance.NextEntryField)) { cursor = this.PrevInputItem(VisualItems, null, Reuse); // need to set cursor position to the last position in the visual item. } else { if (Reuse == true) { cursor.Position -= 1; } else { cursor = new CanvasPositionCursor(this.ItemCursor, this.Position - 1); } } } return(cursor); }