Popup menu on a position with the planner

Hello,

how I could catch right click on a position column in the planner to show a popup menu which depends on the selected position ? Or the same problem for me with other words : can I have the "current" position index when I move above the planner to be able to retrieve it when I use my popupmenu ?
Thank you for answer
Alexandre Boisramé

Hi,

You can drop a TPopupMenu on the form, but don't connect it to the planner. Then use the OnMouseDown event and write this code.

procedure TForm14.TMSFNCPlanner1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Single);
var
  p: TTMSFNCPlannerCacheItem;
begin
  p := TMSFNCPlanner1.XYToPosition(X, Y);
  if p.Kind = ikPositionTop then
  begin
    TTMSFNCUtils.Log(p.Position.ToString);
  end;
end;

You can retrieve the position and then show the popup menu accordingly. (The above code just logs the position)

Thank you, I can do what I want now.
Have a good day
Alexandre

1 Like