Cut, copy, paste via menu items

I'm trying to program three menu items to respectively perform cut, copy and paste operations on TTMSFMXGrid components. (Ctrl+X, Ctrl+C, Ctrl+V work out of the box but I am having some difficulty doing it through menu items.)


I figured out how to do it if entire cells are selected. I don't know if this is the best method but it works for entire cells:

ActiveObj := Focused.GetObject;
  if Assigned(ActiveObj) then
    if ActiveObj is TTMSFMXGrid then
      TTMSFMXGrid(ActiveObj).CutToClipboard(True) ;

But I cannot figure out how to do it if the user is editing a cell and has selected all or part of the cell text. 

In edit mode, you'll need to access the inplace editor and use the clipboard functionality of that control. For TEdit based editors, you can use the following code:


uses
  FMX.Text;

var
  ta: ITextActions;
begin
  if Assigned(TMSFMXGrid1.ActiveEditControl) and Supports(TMSFMXGrid1.ActiveEditControl, ITextActions, ta) then
    ta.CopyToClipboard;