Problem:
The documentation is unclear on what other steps need to be taken to delete a record from a grid control other than using the "RECORD-TO-DELETE" clause.
Specifying this always deletes the first record, starting with the header row.
Resolution:
The secret is using the cursor-x and cursor-y properties of the grid control. Below is an example of the code necessary for deleting a specific record in a grid:
delete-record.
inquire grid-1, cursor-x in grid-x, cursor-y in grid-y.
modify Grid-1, RECORD-TO-DELETE grid-y.
This example assumes the record where the cursor resides in the grid is the one that is to be removed from the grid:
Attached is a zip archive containing a sample program, and its accompanying copybooks, that demonstrates this code usage.
When running the program, after clicking on a cell, press the [Delete] push-button.
Regardless of the column (cursor-x) that the cursor is in, the row, specified by cursor-y will be deleted.
