Recent

Author Topic: Which event should i use on DBGrid in order to catch the click on leftmost cell  (Read 790 times)

Lazikas o Pontios

  • New member
  • *
  • Posts: 7
Hello all,
while i read the Tdbgrid manual and searched in forums,  i cannot figure out which event i must use in order to catch the click on the leftmost cell (the grayed one, which selects rows) in a dbgrid. I know that columns can be catch with .OnTitleClick but what about rows?

Anybody can help?

L.
« Last Edit: February 17, 2023, 11:10:28 am by Lazikas o Pontios »

paweld

  • Hero Member
  • *****
  • Posts: 1061
Code: Pascal  [Select][+][-]
  1. procedure TForm1.DBGrid1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  2. var
  3.   aCol, aRow;
  4. begin
  5.   DBGrid1.MouseToCell(X, Y, aCol, aRow);
  6.   if aCol = 0 then
  7.     ShowMessage(Format('Clicked indicator column on row: %d', [aCol, aRow]));
  8. end;
« Last Edit: February 06, 2023, 03:05:06 pm by paweld »
Best regards / Pozdrawiam
paweld

Lazikas o Pontios

  • New member
  • *
  • Posts: 7
How can i mark this as solved ?

Paweld you are my hero !

L.

Joanna

  • Hero Member
  • *****
  • Posts: 815
You can change the title to include [solved]

I’ve had difficulty with that first column In dbgrid  causing crashes awhile Ago when I clicked it. Hopefully that was fixed. I remember having to do special handling for that column checking if it was zero etc.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

Lazikas o Pontios

  • New member
  • *
  • Posts: 7
I am not allowed to change the subject, don't know why  8-)
I just changed the message icon ...

totya

  • Hero Member
  • *****
  • Posts: 720
I am not allowed to change the subject, don't know why  8-)
I just changed the message icon ...
In the first message click to modify, and change the subject, then save.

Lazikas o Pontios

  • New member
  • *
  • Posts: 7
I did that, this is how i changed the icon to thumbnail. But, unfortunately, i cannot change the subject. Subject box behaves like it is readOnly. Tried with Firefox and Chrome, no luck... Anyway...

 

TinyPortal © 2005-2018