Advertisement
Loque

Lazarus identifica titolo colonna cliccato

Oct 18th, 2021
2,348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.75 KB | None | 0 0
  1. procedure TForm2.DBGrid1MouseDown(Sender: TObject; Button: TMouseButton;
  2.   Shift: TShiftState; X, Y: Integer);
  3.   var
  4.   Col,
  5.   Row : Integer;
  6. begin
  7.   Col := DBGrid1.MouseCoord(X, Y).X;
  8.   Row := DBGrid1.MouseCoord(X, Y).Y;
  9.   if (dgIndicator in DBGrid1.Options) then
  10.     Dec(Col);
  11.   if (Col >= 0) and (Col < DBGrid1.Columns.Count) and (Y < DBGrid1.DefaultRowHeight) then
  12.     if Button = mbRight then
  13.     begin
  14.       case DBGrid1.Columns[Col].Title.Caption of
  15.         'SURNAME':
  16.           showmessage('cliccato sur');
  17.         'STUDENT_NO':
  18.           showmessage('cliccato sutdent no');
  19.         'FORENAME':
  20.           showmessage('worka, wow');
  21.       end;
  22.     //Caption := DBGrid1.Columns[Col].Title.Caption
  23.     end
  24.   else
  25.     Caption := '';
  26. end;  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement