Try OpenEdge Now
skip to main content
Introducing the Progress Developer Studio for OpenEdge Visual Designer
Creating the Customer Window : Adding interface methods
 

Adding interface methods

When you created custormerForm.cls, you specified that it implements the interface, IUpdatable.cls. IUpdatable.cls defines a number of methods for adding, deleting, saving, and canceling updates to database records. Stub code for each of the interface methods is automatically added to the file by default. The stub code has the same signature as the methods specified in the interface file, but the methods themselves are not implemented.
In this exercise, you will replace the DeleteRecord and SaveRecord stub code with methods that actually do something.
You will not change the stub code for the AddRecord and CancelUpdate methods. They are not used by any control in the Customer form, so it is not necessary to implement them. However, methods with the same signatures as those defined in the interface file are required. If methods with identical signatures do not exist, you will get compiler errors. Therefore, you should retain the generated stub code, which looks like the following:
METHOD PUBLIC VOID AddRecord( ):
UNDO, THROW NEW Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
END METHOD.

METHOD PUBLIC VOID CancelUpdate( ):
UNDO, THROW NEW Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
END METHOD.
To update the DeleteRecord and SaveRecord interface methods in customerForm.cls:
1. Open customerForm.cls in the ABL Editor.
2. Replace the stub code of the DeleteRecord and SaveRecord methods with the following:
METHOD PUBLIC VOID DeleteRecord( ):
    oServiceAdapter:RemoveRecord
    (bindingSource1:Handle:get-buffer-handle('ecustomer')).
    oServiceAdapter:SaveData().
END METHOD.

METHOD PUBLIC VOID SaveRecord( ):
     IF bindingSource1:RowModified THEN
     DO:
        bindingSource1:Assign().
        oServiceAdapter:SaveData().
     END.
END METHOD.
3. Save customerForm.cls.