Try OpenEdge Now
skip to main content
GUI for .NET Programming
Binding ABL Data to .NET Controls : Managing data updates : Handling user interface events : Using the PositionChanged event
 
Using the PositionChanged event
The ProBindingSource publishes the PositionChanged event when the value of the Position property changes, either programmatically or in response to a user action. This event passes the standard .NET System.EventArgs class.
An event handler for this event uses the following syntax:

Syntax

EventHandlerName
  (
    INPUT sender AS CLASS System.Object,
    INPUT args   AS CLASS System.EventArgs
  ).
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 System.EventArgs instance that contains the event arguments.
Your event handler can access the ProBindingSource's Position property using the object reference in the System.Object instance. As discussed in Maintaining currency with the Position property , when the bound ABL data source object is a ProDataSet, the Position property always refers to the top-level query. When the user selects a child record, the Position property is set to the position of the corresponding parent record. If your application needs to know the position of the child record, one approach is to create two ProBindingSource objects, one for the parent and one for the child, and to display the child records for a specific parent record in another UI control.
When the value of the Position property changes, the ProBindingSource object automatically synchronizes the buffer in the bound ABL data source object to correspond to the selected record in the bound UI control.
Note that if your application directly changes the 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 use the event handler for PositionChanged to handle any necessary processing. For an example of this technique, see MultipleBindings.p in ProDataSetbinding example.