1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
procedure TForm1.StringGrid1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
ACol, ARow: Integer;
APoint: TPoint;
begin
if ssRight in Shift then
begin
with TStringGrid(Sender) do
begin
MouseToCell(X, Y, ACol, ARow);
// Sélectionne la cellule
Col := ACol;
Row := ARow;
// Appel du popup suivant colonne
APoint := ClientToScreen(Point(X, Y));
case Col of
0: PopupMenu1.Popup(APoint.X, APoint.Y);
1: PopupMenu2.Popup(APoint.X, APoint.Y);
else ...
end;
end;
end;
end; |