Try OpenEdge Now
skip to main content
GUI for .NET Programming
Binding ABL Data to .NET Controls : Managing data updates : Maintaining currency with the Position property

Maintaining currency with the Position property

The Position property's value indicates the currently selected record in the bound UI control. Whenever its value changes, the ProBindingSource automatically synchronizes the buffer in the ABL data source object to the corresponding record. In this way, the application always has the correct record available when an event procedure runs.
Note: When the bound ABL data source object is a ProDataSet, this property always refers to the top-level query.
As shown in the following figure, the currency control works in both directions between the bound UI control and the ProBindingSource. If you select a different record in the UI, the bound UI control updates the property value in the ProBindingSource. If you programmatically change the property value in the ProBindingSource, the ProBindingSource synchronizes the bound UI control to display the newly selected record.
Figure 15. Currency control with Position property
However, the currency control only works going from the ProBindingSource to the ABL data source object. If your application directly navigates to another record in the ABL data source object, the Position property's value does not update. Generally, rather than letting the application change the record, you should change the property value and let the ProBindingSource handle navigating to the new record and updating the bound UI control.
If your application must change the record directly, it also needs to synchronize the bound UI control to the new record. You can achieve this synchronization using the REPOSITION statement and REPOSITION-Xxx( ) methods.
Using any of the Reposition instructions changes the ProBindingSource's Position property to the specified record. These instructions move the cursor to before the specified record in the result list. When you have an ABL Browse widget linked to a query, the Browse automatically does a GET NEXT to get the specified record into the buffer. So, using any of the Reposition instructions automatically results in the Browse positioning to the specified record. The ProBindingSource is designed to match this behavior.