OnNewCurrentRecord can be thought of as a post-find/clear/save/delete event since it gets called after every record find, clear, save and delete. It is called whenever CurrentRowId changes.
OnNewCurrentRecord is passed two RowId parameters: the old record RowId and the new record RowId. By looking at these two parameters, you can tell if the DDO has found a record or if it is creating a new one (if the new RowId is null).
You cannot use this procedure to change the Current RowId This message is sent to notify of a change that is going to happen. You cannot abort the change.
OnNewCurrentRecord is sent when the current record is changing, with two exceptions. If a DDO becomes in-use and the record being established is null, OnNewCurrentRecord will be called (old record =null new record =null). After a save, OnNewCurrentRecord is called for all DDOs that participated in the save, even if the record did not change. If you need to test for this condition, you could check Operation_Mode and see if it is Mode_Saving.
Procedure OnNewCurrentRecord RowId riOldRec RowId riNewRec
Forward Send OnNewCurrentRecord riOldRec riNewRec
// Assume we want to trap saves of existing records.
If (Operation_Mode = Mode_Saving AND ;
IsSameRowId(riOldRec,riNewRec) ) Begin
:
End
Else ...
End_Procedure
This message must be forwarded.
This event does not exist in DataFlex version 10.1 and below. Instead the event New_Current_Record is used. This event is passed integer record numbers instead of RowIds. The New_Current_Record event is still called but is considered to be obsolete. OnNewCurrentRecord is the preferred replacement.
Defining Data Dictionary Events