Popup from selectedrow

How to use TMXfmxPopup, if you want it to popup from the selected Row? 
(grid selection = SingleRowSelect)


if MEMO.Lines.Count>0 then begin
      PopupOpm.PlacementTarget:=GRID.GetCellObject(cell(clientdataset.RecNo,0));
      PopupOpm.Popup;
end else
      PopUpOpm.ClosePopup;

But the postion is wrong.

Also when using singlerowSelect, Grid.selected has 0 items. And so does grid.selectedRow.

if MEMO.Lines.Count>0 then begin
      PopupOpm.PlacementTarget:=GRIDadr.GetCellObject(cell(Gridadr.selectedrow[0],0));
      PopupOpm.Popup;
end else
      PopUpOpm.ClosePopup;

so i cannot use this,because this returns nil as placementtarget.

greetings filip

Can you try the following:


var
  obj: TControl;
  cl: TCell;
  x, y, w, h: Single;
  p: TPointF;
begin
  cl.Col := 0;
  cl.Row := 0;
  obj := TMSFMXGrid1.GetCellObject(cl) as TControl;
  x := obj.Position.X;
  y := obj.Position.Y;
  w := obj.Width;
  h := obj.Height;

  TMSFMXPopup1.PlacementTarget := TMSFMXGrid1;
  TMSFMXPopup1.PlacementRectangle.Rect := RectF(X, Y, X + w, Y + h);
  TMSFMXPopup1.Placement := TPlacement.plBottomCenter;
  TMSFMXPopup1.Popup;

Kind Regards, 
Pieter