+3  A: 

The VCL is designed to give menu item shortcuts precedence. You can, however, write your item click handler (or action execute handler) to do some special handling when ActiveControl is TCustomEdit (call Undo, etc.)

Edit: I understand you don't like handling all possible special cases in many places in your code (all menu item or action handlers). I'm afraid I can't give you a completely satisfactory answer but perhaps this will help you find a bit more generic solution. Try the following OnShortCut event handler on your form:

procedure TMyForm.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
var
  Message: TMessage absolute Msg;
  Shift: TShiftState;
begin
  Handled := False;
  if ActiveControl is TCustomEdit then
  begin
    Shift := KeyDataToShiftState(Msg.KeyData);
    // add more cases if needed
    Handled := (Shift = [ssCtrl]) and (Msg.CharCode in [Ord('C'), Ord('X'), Ord('V'), Ord('Z')]);
    if Handled then
      TCustomEdit(ActiveControl).DefaultHandler(Message);
  end
  else if ActiveControl is ... then ... // add more cases as needed
end;

You could also override IsShortCut method in a similar way and derive your project's forms from this new TCustomForm descendant.

TOndrej
In this case I must know all controls. In reality it is a more complex application with dynamically created views (even from plugins), so it would be easily possible to forget some controls or in case of external plugins controls cannot be accessed.
Stebi
Unfortunatelly this even doesn't work.procedure TForm1.Undo1Click(Sender: TObject);begin if ActiveControl is TMemo then Exit; ShowMessage('Undo');end;I prevent executing the undo function, but the Memo doesn't execute its own undo function either.
Stebi
Stebi
+1  A: 

You probably need an alike solution as below. Yes, feels cumbersome but this is the easiest way I could think of at the time. If only Delphi allowed duck-typing!

  { you need to derive a class supporting this interface 
    for every distinct control type your UI contains }
  IEditOperations = interface(IInterface)
    ['{C5342AAA-6D62-4654-BF73-B767267CB583}']
    function CanCut: boolean;
    function CanCopy: boolean;
    function CanPaste: boolean;
    function CanDelete: boolean;
    function CanUndo: boolean;
    function CanRedo: boolean;
    function CanSelectAll: Boolean;

    procedure CutToClipBoard;
    procedure Paste;
    procedure CopyToClipboard;
    procedure Delete;
    procedure Undo;
    procedure Redo;
    procedure SelectAll;
  end;

// actions....

procedure TMainDataModule.actEditCutUpdate(Sender: TObject);
var intf: IEditOperations;
begin
  if Supports(Screen.ActiveControl, IEditOperations, intf) then
    (Sender as TAction).Enabled := intf.CanCut
  else
    (Sender as TAction).Enabled := False;
end;

procedure TMainDataModule.actEditCutExecute(Sender: TObject);
var intf: IEditOperations;
begin
  if Supports(Screen.ActiveControl, IEditOperations, intf) then
    intf.CutToClipBoard;
end;

....
utku_karatas