/// <summary> /// Will set selection box and focus to cell content text box /// when form is first shown /// </summary> private void HandleFirstShown() { // Set selection box on start up to A1 or 0,0 FormSpreadsheetPanel.SetSelection(0, 0); // Set focus CellContentTextBox.Focus(); }
/// <summary> /// Will add the content in cell content text box to cell then /// move selection on the form spreadsheet panel to the right preventing it from going beyond the edge. /// If movement would cause selection to go beyond edge nothing will happen. /// Returns true if key press was handled. /// </summary> /// <returns>true if key press was handled</returns> private bool MoveRight() { FormSpreadsheetPanel.GetSelection(out int col, out int row); if (col < 25) { AddCellContentToCurrentCell(); FormSpreadsheetPanel.SetSelection((col + 1), row); UpdateTextBoxesAndFocus(FormSpreadsheetPanel); } return(true); }
/// <summary> /// Will add the content in cell content text box to cell then /// move selection on the form spreadsheet panel down preventing it from going beyond the edge. /// If movement would cause selection to go beyond edge nothing will happen. /// Returns true if key press was handled. /// </summary> /// <returns>true if key press was handled</returns> private bool MoveDown() { FormSpreadsheetPanel.GetSelection(out int col, out int row); if (row < 98) { AddCellContentToCurrentCell(); FormSpreadsheetPanel.SetSelection(col, (row + 1)); UpdateTextBoxesAndFocus(FormSpreadsheetPanel); } return(true); }