Atozed Forums
How to select dbgrid row by click - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: How to select dbgrid row by click (/thread-1854.html)



How to select dbgrid row by click - softdev85 - 08-07-2020

Hello,
i don't arrive solve my problem,
i think is  simple,

just when i click on dbgrid select the row

thank's a lot for your help
best regards


RE: How to select dbgrid row by click - Сергей Александрович - 08-12-2020

In Properties:
dgTails.columns[1].LinkField := KLY;

and

procedure TfmTail.dgTailsColumns1Click(ASender: TObject; const AValue: string);
begin
with dmTail do
begin
if tTails.FieldByName('KLY').AsString = AValue then
begin
btPlanClick(ASender);
end else begin
tTails.First;
while not tTails.Eof do
begin
if tTails.FieldByName('KLY').AsString = AValue then break;
tTails.Next;
end;
end;
end;
end;


RE: How to select dbgrid row by click - softdev85 - 08-12-2020

Hello,
thank you very mutch that work very well
Thank's a lot.

do you knwon if it's possible to change row color on row select ?

Thank's a lot for your help
best regards

hello,

here the solution that work well for information in future

procedure TIWFormModifTache.IWDBGridListeTachesRenderCell(ACell: TIWGridCell;
  const ARow, AColumn: Integer);
begin

          // -1 is Footer Row
  if ARow = -1 then
  begin
    ACell.BGColor := clSilver;
    if AColumn = 0 then
    begin
      ACell.Font.Color := clRed;
      ACell.Text := IntToStr(IWDBGridListeTaches.RecordCount);
    end;
  end
  else if IWDBGridListeTaches.RowIsCurrent then
  begin
    ACell.BGColor := clYellow;
  end;
end;