Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Grid for Microsoft .NET User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

5.5 Using .NET Cell Controls

The following C# code shows the simplest use-case for using a .NET control in a grid cell. It illustrates the use of a .NET TextBox in grid cell 1, 1.

You can dramatically customize the behavior of .NET cell controls using the following mechanisms:

Table 26 lists and describes the public properties available for the CellControl class.

Table 26: Cell Control Properties

Property Description
DrawInactiveCell Gets or sets a value that is true if you want the grid to draw inactive cell contents. When you are drawing inactive cells, set the value to false.
Grid Gets the GridControl with which this custom control is associated.
ProcessHorizontalArrows Gets or sets a value that is true if your custom control processes horizontal arrow key events. If false, the right and left arrow keys move the current cell in the corresponding direction.
ProcessVerticalArrows Gets or sets a value that is true if your custom control processes vertical arrow key events. If false, the up and down arrow keys move the current grid cell in the corresponding direction.
UseCellStyle Gets or sets a value that indicates whether the cell style from the grid should be applied to the custom control. If true, the font, background color, and text color stored in the grid are applied to the control when it is initialized as the current cell. If false, the settings applied to the .NET control are used to display the control.

Table 27 lists and describes the public events available for the CellControl class. For each of these events, a corresponding On event handler raises the event. Each On event handler is invoked by the grid, and in turn, the event handler raises the event, invoking any delegates that you may have attached to the event.

For more detailed information describing the default processing associated with each of these events, see CellControl in the Objective Grid for Microsoft® .NET® Reference Guide.

Table 27: CellControl Events

Event Description
CanceledEditing This event is raised when the current cell's contents are canceled and the control has been reinitialized.
CancelEditing This event is raised when the user has pressed ESC on the current cell.
DrawCellControl This event is raised each time this CellControl is drawn, which depends mostly upon whether the cell is the current cell. The event arguments for this event indicate whether the cell is the current cell. At this time, this event is intended to notify when cells are drawn and to allow the end user to implement custom drawing logic for inactive cell controls.
EndEditing This event is raised when the user confirms the cell's data, and the data is valid. You are given the opportunity to indicate whether the data are accepted via the event arguments.
HideCurrentCell This event is raised when the CellControl should be hidden.
InitCurrentCell This event is raised by GridControl when the intrinsic state (for example, row, column, and Style*) of the control for the current cell needs to be initialized. It is invoked when the current cell has moved and the CellControl is being initialized as the new current cell.
LeftCell This event is raised after the current cell is deactivated. At the time this event is raised, the grid does not have a current cell. You can attach a delegate to this event if you want to control the refreshing of the current cell after it is deactivated.
ModifyCell This event is raised when the user modifies the cell's contents.
RefreshCurrentCell This event is raised when the cell needs to be refreshed.
ResetCurrentCell This event is raised when the grid resets the intrinsic state of the control. This happens when the current cell is moving.
StartEditing This event is raised when the user starts editing the cell by pressing a key or moving the mouse.
StoreCurrentCell This event is raised to store the cell's data to the grid. For efficiency, this method is raised only if the cell contents are modified. For your convenience, the cell is marked as modified as part of the event handling for the StartEditing event.
ValidateCell This event is raised to validate the contents of a grid cell.


Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.