/// <summary> /// add the row/col adjustment factor to the canvas cursor. /// </summary> /// <param name="RowCol"></param> /// <returns></returns> public CanvasPositionCursor Add(IRowCol RowCol) { CanvasPositionCursor canvasCursor = null; if (RowCol == null) { canvasCursor = this; } else { var itemCursor = this.ItemCursor; var pos = this.Position; IRowCol outsideRowCol = null; if (this.OutsideRowCol != null) { outsideRowCol = this.OutsideRowCol.Add(RowCol); } if (itemCursor == null) { canvasCursor = new CanvasPositionCursor(outsideRowCol as ZeroRowCol); } else { canvasCursor = new CanvasPositionCursor(itemCursor, pos); } } return(canvasCursor); }
public static CanvasPositionCursor PrevInputItem( this CanvasPositionCursor Cursor, ScreenVisualItems VisualItems, VisualFeature?Feature = null, bool Reuse = true) { VisualItemCursor vc = null; var cursor = Cursor; if (cursor.IsOutsideVisualItem() == true) { vc = VisualItems.FindPrevInputItem(cursor.RowCol, Feature); } else { vc = Cursor.ItemCursor.PrevInputItem(Feature); } if (vc == null) { cursor = null; } else if (Reuse == true) { cursor.ItemCursor = vc; cursor.Position = 1; } else { cursor = new CanvasPositionCursor(vc, 1); } return(cursor); }
/// <summary> /// apply the text entered from the keyboard onto the visual item located by /// the canvas cursor. Handle error where the canvas cursor item is not input /// capable. /// </summary> /// <param name="Cursor"></param> /// <param name="Text"></param> /// <param name="Reuse"></param> /// <returns></returns> public Tuple <VisualItem, string> PutKeyboardText( CanvasPositionCursor Cursor, string Text, bool Reuse = true) { string errmsg = null; VisualItem visualItem = null; if (Cursor.IsInputItem( ) == true) { visualItem = Cursor.PutKeyboardText(Text); // send the keyboard input to the master thread. That thread applies input // and WTD commands to the master screenContent block. if (this.MasterThread != null) { var kbInput = new KeyboardInputMessage() { RowCol = Cursor.RowCol as ZeroRowCol, Text = Text }; this.MasterThread.PostInputMessage(kbInput); } } else { errmsg = "not entry field"; } return(new Tuple <VisualItem, string>(visualItem, errmsg)); }
public void StartBlink(CanvasPositionCursor Cursor, bool TraceBlinkPos = false) { this.Location = Cursor.RowCol; if (BlinkTimer == null) { StartTimer(); } BlinkSymbol(this.Location, this.SymbolText, TraceBlinkPos); }
public CanvasPositionCursor PutKeyboardText_AdvanceCaret( CanvasPositionCursor Cursor, string Text, bool Reuse = true) { CanvasPositionCursor cursor = Cursor; var rv = PutKeyboardText(cursor, Text, Reuse); var errmsg = rv.Item2; if (errmsg == null) { cursor = cursor.AdvanceRight(this.VisualItems, HowAdvance.NextEntryField, Reuse); } return(cursor); }
public static CanvasPositionCursor PrevInputItemCircular( this CanvasPositionCursor Cursor, ScreenVisualItems VisualItems, VisualFeature?Feature = null, bool Reuse = true) { var posCursor = Cursor.PrevInputItem(VisualItems, Feature, Reuse); if (posCursor == null) { var ic = VisualItems.InputItemList().Last(); if (ic != null) { posCursor = new CanvasPositionCursor(ic); } } return(posCursor); }
/// <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); }
public static CanvasPositionCursor NextInputItemNextLine( this CanvasPositionCursor PosCursor, ScreenVisualItems VisualItems) { var posCursor = PosCursor; // save the row/col of the current var startRowCol = PosCursor.RowCol; while (true) { posCursor = posCursor.NextInputItemCircular(VisualItems); if (startRowCol.RowNum != posCursor.RowCol.RowNum) { break; } if (posCursor.RowCol.CompareTo(startRowCol) != 1) { break; } } return(posCursor); }