Crash Course Delphi 18 [beta]:
|
Add and delete recordsAdding recordsAnalysis:
Deleting recordsAnalysis: 1. If the stringgrid is not focused, then stop processing (exit the procedure). Because in this case, it's not clear as to which row must be deleted. 2. Delete or blank the row: start by saving the current row number. Next: 2.1 If there are more than 2 rows in the stringgrid (the fixed top row plus at least 2 rows with data), then... 2.1.1 If there are rows after the current row, then... 2.1.1.1 Shift all these rows up 1 position. Next, go to step 2.1.2 2.1.2 Delete the last row from the stringgrid. In code: decrement its RowCount by 1. 2.2 But if there are only 2 rows left, the fixed top row plus 1 row with data, then "blank" (empty) the cells of the
current row. |