1
I’m going through the following problem with a TDBGrid
.
That one TDBGrid
is with the option dgMultiSelect
active. The problem is, I want, with one click the line to be selected as if it had pressed Ctrl + Mouse click and that’s what I don’t know how to do.
Code :
procedure TfrmPrincipal.GridCellClick(Column: TColumn); var sValorColunaAtivo: Integer; begin if UpperCase(Column.FieldName) = 'SELECTED' then begin if DM.FDMemTableExpedicao.FieldByName('SELECTED').AsInteger = 1 then sValorColunaAtivo := 0 else sValorColunaAtivo := 1; // edita o DataSet, inverte o status e grava os dados DM.FDMemTableExpedicao.Edit; DM.FDMemTableExpedicao.FieldByName('SELECTED').AsInteger := sValorColunaAtivo; DM.FDMemTableExpedicao.Post; end; end;
good idea plus the issue of counting selected items will still lose.
– Edu Mendonça
@Why would you lose? This event is only painting the line, you can easily catch the items or count by Grid or Dataset.
– Felipe Godinho
I tested only that it does not count how many are selected.
– Edu Mendonça