I am using Delphi 10.1 Berlin to make a Multi-Device application. I have a TStringGrid
in order to list some data from a query.
I also have a popup menu (edit, delete, ...), but in order to edit/delete an item I have to click on a cell using the left mouse button.
Is it possible to "select a row" using only the right button before showing the popup menu?
I tried:
procedure TForm1.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbRight then
StringGrid1.Perform(WM_LBUTTONDOWN, 0, MakeLParam(Word(X), Word(Y)));
end;
But it displays an error on mbRight
and on Perform()
.
firemonkey
tag for FMX applications. – Tom BrunbergOnMouseDown
event? FMXTStringGrid
doesn't expose such event. – Tom BrunbergOnMouseDown
:) I was teasing OP on their code which obviously was just copied from the other Q/A. But please enter an answer based on the pastebin – Tom Brunberg