Friday, July 04, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » Models » Selection

Previous Understanding Selection Data Model Next

  Back to Top
 Selection Model
The selection model includes any of the settings related to ranges of selected cells. This may include methods such as counting the number of selected ranges, adding and removing selections, clearing selections and finding whether a cell is selected.

To use the underlying selection model, use the methods of the selection model. These include the SetSelection method, for setting cells as selected, and the AddSelection, ClearSelection and RemoveSelection methods for adding, clearing, and removing selected ranges from the sheet.

The default implementation of the selection model (BaseSheetSelectionModel) handles the selection of cells and ranges in the sheet, and stores the actual cell and range coordinates for each selection. The SpreadView object handles the user interface for the SheetView object and updates the selection model from various event handlers. The selection model handles the selection data, including computing the range being selected based on the cell clicked (the anchor cell) and the cell under the mouse. The SheetView.GetSelection method and SheetView.SelectionCount property are wrapping the ISheetSelectionModel indexer and Count property. When there is no selection in the model, the count is 0 and GetSelection returns null. Some events cause the anchor cell in the selection model to get set (that is, left mouse button down on a cell) so the selection model has the active cell as a selection. If you enter edit mode then cancel it by pressing the Escape key (Esc), or if you use the keyboard to move the active cell around instead of the mouse, then the selection model may get cleared. You should check the SelectionCount before using GetSelection, and in the case where it returns 0, use the ActiveColumnIndex and ActiveRowIndex properties.



    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
SD Times 'TOP 100' Industry Innovator - Read the press release (pdf)

Tour Home
Overview
Appearance
User Interaction
Cell Types
Formulas
Managing Data
Data Binding
Import/Export
Printing
Keyboard Interaction
Shapes
Models
Spread Designer
 
Map

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.