In testing the integer values of a column moved (FromIndex / ToIndex), I was surprised to see the ever-hidden ID column started at Index 1 instead of Index 0. The Table for the Grid (I tested this on both the TDBGrid and the TRxDBGrid) is like this:
'CREATE TABLE IF NOT EXISTS customers(' +
'cust_id INTEGER PRIMARY KEY AUTOINCREMENT, ' +
'cust_fname VARCHAR(20), ' +
'cust_lname VARCHAR(20), ' +
'cust_company VARCHAR(30), ' + ...
When I moved the fname column @index 1 one slot to the right, I thought it'd be in index 2 position. But, it wasn't. It was @index 3
procedure TForm_Main.DBGrid_AddCustomersColumnMoved(Sender: TObject; FromIndex,
ToIndex: Integer);
var
x,y : Integer;
begin
x := FromIndex;
y := ToIndex;
ShowMessage('Column moved from ' + IntToStr(x) + ' to ' + IntToStr(y));
end;
The result is shown in the pic below. I just thought it was interesting how these two Grids' Column Titles start @index 1 instead of index 0. On face value, it affects nothing I can see. Or am I missing something here?