I have assigned a popup menu to my TImageEnMView at design-time:
However, when I right-click an image on the TImageEnMView, the popup menu is not shown!
Even when setting the PopupMenus property to any value, it does not show the popup menu.
When I show the popup menu in the MouseDown event handler, the right-clicked image is not selected before the popup menu is displayed:
procedure TForm1.ImageEnMView1MouseDown(Sender: TObject; Button: System.UITypes.TMouseButton; Shift: TShiftState; X, Y: Integer);
var
ScreenPoint: TPoint;
begin
if Button = Vcl.Controls.mbRight then
begin
// Get the index of the image cell at the mouse position?
// ImageEnMView1.SelectImage(ImageEnMView1.MouseDownThumbIndex);
// Convert the mouse position of the clicked control to screen coordinates:
ScreenPoint := ImageEnMView1.ClientToScreen(Point(X, Y));
// Show the popup menu at the mouse position:
PopupMenuOptions.Popup(ScreenPoint.X, ScreenPoint.Y);
end;
end;
How to solve this dilemma?
(BTW, the term MouseDownThumbIndex is not found in the CHM documentation).