Esempio n. 1
0
        /// <summary>Invoked when the user clicks a mouse button.</summary>
        /// <param name="sender">Sender of event.</param>
        /// <param name="evnt">The event data.</param>
        private void OnMouseClickEvent(object sender, SheetEventButton evnt)
        {
            int colIndex;
            int rowIndex;

            if (sheet.CellHitTest(evnt.X, evnt.Y, out colIndex, out rowIndex) &&
                rowIndex >= sheet.NumberFrozenRows)
            {
                selectedColumnIndex = colIndex;
                selectedRowIndex    = rowIndex;
                sheetWidget.GrabFocus();
                sheet.Refresh();
            }
        }
Esempio n. 2
0
        private void OnEntryKeyPress(object sender, KeyPressEventArgs args)
        {
            if (args.Event.Key == Gdk.Key.Escape)
            {
                entry.KeyPressEvent -= OnEntryKeyPress;
                fix.Remove(entry);
                entry = null;
                sheet.Refresh();
                sheet.GrabFocus();
            }
            else if (args.Event.Key == Gdk.Key.Return)
            {
                Selection.GetSelection(out int selectedColumnIndex, out int selectedRowIndex);
                sheet.DataProvider.SetCellContents(selectedColumnIndex, selectedRowIndex, entry.Text);

                entry.KeyPressEvent -= OnEntryKeyPress;
                fix.Remove(entry);
                entry = null;

                sheet.Refresh();
                sheet.GrabFocus();
            }
        }