I have a grid of entries the user will click on to multi-select for a process. Some of the entries will be invalid based upon values of the first selected row.
I know about DBGrid.SelectedRows.CurrentRowSelected
, but I cannot find a suitable place for checking my conditions to set it to True or False.
Something like this:
var
bm: TBookmark;
CachedIdentity: String;
CanSelect: Boolean;
begin
with dgbSkypeConversations do
begin
if SelectedRows.Count > 0 then
begin
DataSource.DataSet.DisableControls;
bm := DataSource.DataSet.GetBookmark;
CachedIdentity := DataSource.DataSet.FieldByName('identity').AsString;
DataSource.DataSet.GotoBookmark(SelectedRows[0]);
CanSelect := DataSource.DataSet.FieldByName('identity').AsString <> CachedIdentity;
DataSource.DataSet.GotoBookmark(bm);
DataSource.DataSet.FreeBookmark(bm);
SelectedRows.CurrentRowSelected := CanSelect;
DataSource.DataSet.EnableControls;
end;
end
end;
I have tried the OnMouseDown
events in Application.OnMessage
and of the DBGrid and the Form, but they do not work, and there is no TBookmarkList.BeforeInsertItem
event. What can I do or must I change?