Skip to content

SynchronizeGridtoSelectedRow - cCJGrid

Forces the grid to synchronize itself to the datasource's SelectedRow and display this row at the offset preference

Type: Procedure

Parameters

Parameter Type Description
iRowOffsetPreference Integer An offset preference for displaying this row, where 0 or is the first visible row in the grid, 1 is the second visible row, etc. ropBottom, ropCenter and ropTop constants apply.

Syntax

Procedure SynchronizeGridtoSelectedRow Integer iRowOffsetPreference

Call Example

Send SynchronizeGridtoSelectedRow iRowOffsetPreference

Description

SynchronizeGridToSelectedRow makes sure that the grid's current row focus is the same as the datasource's SelectedRow and that the row is displayed.

iRowOffsetPreference represents the visible row where you'd like the SelectedRow to appear. This is a suggested offset, since the grid may need to adjust the offset. For example, the first row of a grid can only be displayed as the top row.

Special row preferences ropBottom and ropCenter can be used to specify the bottom or center of the grid. ropTop can also be used, but it is the same as using 0.

The ropBottom and ropCenter offsets can only be used if your grid uses fixed height rows. A grid uses fixed height rows if all column objects set pbMultiLine to False, which is the default.

If rows are not a fixed height, the grid has no way of knowing how many rows there are in the visible grid and it therefore cannot calculate a bottom or center.

The offset preference cannot be negative and the grid will always attempt to make the SelectedRow visible.

This is a low level message and only should be sent when the datasource has changed the SelectedRow and you need to synchronize the grid with this change. Because this is a synchronization process, it does not fire any of the normal row changing events and it does not attempt to reset the SelectedRow in the datasource. In most cases, you want these row changing events to be sent and should use the message MoveToRow to move to the desired row and Set ComTopRowIndex to adjust the offset.