Hi, Boki:
I have added a new grid to my project (not a converted NG5 grid). It is a simple non-treed grid that lists users. It is loaded from a database. On selection of a user in the grid, the dataset is LOCATED and that in turn displays a more complete series of DB related components and fills them (wwRecordPanel, wwDBEdit, etc).
If I use a mouse click to select a row, all is well, but if I use the events in a Navigator Bar (next, prior, top, bottom), the row is moved and scrolled to, but the row is not selected visually with the selected row settings, nor is the indicator visible for the selected row.
What appears to be true is that setting Row[x].Selected := true does not:
1. Fire the OnSelect Event
2. Set the Selected Row settings (full row, selected text color, selected row color)
3. Does not display the Indicator for the programmatically selected row, which otherwise is shown when using the mouse click.
Am I missing something here to make this work as expected?
Thank you,
Chuck
p.s. in Delphi 10.2.1, Win10
Here is my code for going to the top row:
if Button = nbFirst then
begin
with gridTVUsers do
begin
Row[0].Selected := True;
ScrollToTop;
UserID := Cell[NxNumberUserID.Index, 0].AsInteger;
qryUsers.Locate('USER_ID', UserID, []);
end;
end;
Here is my code for going to the next row:
else if Button = nbNext then
begin
with gridTVUsers do
begin
if RowExists(SelectedRow + 1) then
begin
ActiveView.ScrollToRow(SelectedRow + 1);
Row[SelectedRow + 1].Selected := true;
UserID := Cell[NxNumberUserID.Index, SelectedRow].AsInteger;
qryUsers.Locate('USER_ID', UserID, []);
end;
end;
end
Here is my OnSelect event:
with gridTVUsers do
begin
UserID := Cell[NxNumberUserID.Index, ARow].AsInteger;
// before moving off record, post any changes
if qryUsers.State in [dsEdit, dsInsert] then
begin
qryUsers.Post;
qryUsers.IB_Transaction.Commit;
end;
qryUsers.Locate('USER_ID', UserID, []);
end;
FillAccessGroups(qryUsers.FieldByName('group_access').asString,
clbxNMTAttendence);
FillCPUID_RegDate(qryUsers.FieldByName('CPUID_REGISTRATION_Date').AsInteger,
dtpCPUID_RegDate); // here, below
// 8/19/16 set radio group status... Fields below are now boolean, not 0/1
rgPurchasePlan.ItemIndex := StrToInt(IIF(qryUsers.FieldByName('SYSTEM_SUBSCRIPTION')
.AsString= 'TRUE','1','0'));
rgSupportPlan.ItemIndex := StrToInt(IIF(qryUsers.FieldByName('SUPPORT_SUBSCRIPTION')
.AsString = 'TRUE','1','0'));