На форме FireMonkey – Memo, ActionList, MainMenu
В ActionList добавим 3 элемента acCopy acCut acPaste
Напишем обработчики для элементов ActionList
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
procedure TForm1.acCopyExecute(Sender: TObject); begin Memo.CopyToClipboard; end; procedure TForm1.acCutExecute(Sender: TObject); begin Memo.CutToClipboard; end; procedure TForm1.acPasteExecute(Sender: TObject); begin Memo.PasteFromClipboard; end; |
Далее – актуализируем через Update
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
procedure TForm1.acCopyUpdate(Sender: TObject); begin acCopy.Enabled := (Memo.SelLength>0); end; procedure TForm1.acCutUpdate(Sender: TObject); begin acCut.Enabled:=(Memo.SelLength>0) end; procedure TForm1.acPasteUpdate(Sender: TObject); var Clip:IFMXClipboardService; s:string; begin if TPlatformServices.Current.SupportsPlatformService(IFMXClipboardService,IInterface(Clip)) then begin s:=Clip.GetClipboard.ToString; acPaste.Enabled:=s.Length>0 end else acPaste.Enabled:=false; end; |