The ProBindingSource publishes the OffEnd event when record batching is enabled and the bound UI control reaches the last row of the current result set. This event uses an OpenEdge built-in class, Progress.Data.OffEndEventArgs, that extends the .NET System.EventArgs class to pass the event arguments. The event argument class contains the RowsAdded property, which passes to the ProBindingSource the number of records that you just added to the result set.
An event handler for this event uses the following syntax:
Syntax
EventHandlerName (
INPUT sender AS CLASS System.Object,
INPUT args AS CLASS Progress.Data.OffEndEventArgs
).
Where EventHandlerName is the name of the event handler, sender is the object reference to the ProBindingSource, and args is the object reference to the OffEndEventArgs instance that contains the event arguments.
If the Batching property is TRUE, this event fires when a bound control asks for column values for the last record of the query on the client. For example, the event fires when the user encounters the last record while scrolling, or if the application gets the last record.
When your event handler receives this event, it should request the next batch of records from the AppServer and add them to the result set. Before returning, the event handler must set the RowsAdded property of the OffEndEventArgs object parameter to the number of added rows. Once the application has retrieved all the records from the database, the event handler should set the Batching property to FALSE. Setting Batching to FALSE prevents this event from firing again.
There is a special case involving the End key and grids. If you enable the End key to scroll the grid, you cannot have a new row at the bottom of the grid when the Batching property is TRUE. In this case, the End key applies focus to the empty new row and the OffEnd event is not called.
The Microsoft DataGridView always displays the new row at the bottom of the grid. You should never enable both the new row and the End key with the DataGridView.
The UltraGrid has an enumerator whose members control the placement of the new row. You can work around this special case by moving the new row to the top of the grid. For example, the following code displays the new row at the bottom of the grid:
Note that the ProBindingSource only supports batching for the top-level query. When the ProBindingSource is bound to a ProDataSet, the event handler retrieves all child records for a specific parent record. In cases where you have large numbers of child records for each parent, you might need to create another ProBindingSource with its top-level query set to the child table and bind it to a different UI control to display the child records. You can then apply batching to the child records independent of the parent records.
Rather than calling CREATE-RESULT-LIST-ENTRY each time your application adds a batch of records to the result set, your application could reopen the query. However, reopening the query while handling this event does not prompt an automatic refresh.