Esempio n. 1
0
        /*** Selected Cell ***/
        /// <summary>
        /// Displays the selected cell in the non editable cell box.
        /// </summary>
        private void DisplaySelectedCell(SS.SpreadsheetPanel ss)
        {
            int row, col;

            // Save the users selection
            ss.GetSelection(out col, out row);

            // Get the old cell and set it's value, skipping if it's the first
            // selection seen so far
            int oldRow, oldCol;
            GetCellCoords(selectedCellText.Text, out oldCol, out oldRow);
            // oldRow and oldCol will be -1 if this is the first selection seen so far
            if (oldRow >= 0 && oldCol >= 0) {
                ss.SetSelection(oldCol, oldRow);

                // Check if the contents have changed, doing nothing if they haven't
                if (CheckForChanges(oldCol, oldRow))
                    ChangeCellValuebyServer(ss);

                // Restore the selection to the user selection
                ss.SetSelection(col, row);
            }

            // Display the cell name in the Cell text box
            string name = GetCellName(col, row);

            selectedCellText.Text = name;

            // Set the valueTextBox to the cell value
            valueTextBox.Text = GetValue(name);

            // Set the cellContents text box to the cell contents
            contentsTextBox.Text = GetContents(name);

            // Make sure focus is in the correct spot
            InsertMode = InsertMode;
        }