Forum > Databases

Which event should i use on DBGrid in order to catch the click on leftmost cell

(1/2) > >>

Lazikas o Pontios:
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?



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.DBGrid1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);var  aCol, aRow;begin  DBGrid1.MouseToCell(X, Y, aCol, aRow);  if aCol = 0 then    ShowMessage(Format('Clicked indicator column on row: %d', [aCol, aRow]));end;

Lazikas o Pontios:
How can i mark this as solved ?

Paweld you are my hero !


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.

Lazikas o Pontios:
I am not allowed to change the subject, don't know why  8-)
I just changed the message icon ...


[0] Message Index

[#] Next page

Go to full version