/// <summary> /// Given a spreadsheet, find the current selected cell and /// create a popup that contains the information from that cell /// </summary> /// <param name="ss"></param> private void DisplaySelection(SpreadsheetGridWidget ss) { int row, col; string value; ss.GetSelection(out col, out row); ss.GetValue(col, row, out value); if (value == "") { ss.SetValue(col, row, DateTime.Now.ToLocalTime().ToString("T")); ss.GetValue(col, row, out value); MessageBox.Show("Selection: column " + col + " row " + row + " value " + value); } }
/// <summary> /// Given a spreadsheet, find the current selected cell and /// create a popup that contains the information from that cell /// </summary> /// <param name="ss"></param> private void DisplaySelection(SpreadsheetGridWidget ss) { int row, col; string value; ss.GetSelection(out col, out row); ss.GetValue(col, row, out value); //if (value == "") //{ // ss.SetValue(col, row, DateTime.Now.ToLocalTime().ToString("T")); // ss.GetValue(col, row, out value); // // MessageBox.Show("Selection: column " + col + " row " + row + " value " + value); //} cellName.Enabled = false; cellName.Text = getCellName(col, row); }
// //Events // /// <summary> /// Given a spreadsheet, find the current selected cell and /// create a popup that contains the information from that cell /// </summary> /// <param name="ss"></param> private void DisplaySelection(SpreadsheetGridWidget ss) { int row, col; ss.GetSelection(out col, out row); string name = letters[col] + (row + 1); //Row+1 is necessary since the grid starts at (0,0), but the cell names start at A1 //If the user clicks on a cell, add that cell to the Dictionary that maps the grid (x,y) to its proper "letter/number" name. Point coordinate = new Point(col, row); if (!coordinateMap.ContainsKey(coordinate)) { coordinateMap.Add(coordinate, name); } // Cell Name and Cell Value are displayed in respective text boxes cellName_Textbox.Text = coordinateMap[coordinate]; cellValue_Textbox.Text = spreadsheet.GetCellValue(name).ToString(); //Cell contents are displayed in the textbox when the user selects the cell. input_Textbox.Text = spreadsheet.GetCellContents(name).ToString(); }