菜单的项目是否可用
TPopupMenu.OnPopup事件
把代码放在这里面判断
//
------------------------------------------------------------------------------
------------------------------------------------------------------------------
procedure Tfrm_Main.pm_EditorPopup(Sender: TObject);
begin
mni_Undo.Enabled:=
document.queryCommandEnabled('Undo');
document.queryCommandEnabled('Undo');
mni_Redo.Enabled:=
document.queryCommandEnabled('Redo');
document.queryCommandEnabled('Redo');
mni_Cut.Enabled:=
document.queryCommandEnabled('Cut');
document.queryCommandEnabled('Cut');
mni_Copy.Enabled:=
document.queryCommandEnabled('Copy');
document.queryCommandEnabled('Copy');
mni_del.Enabled:=
document.queryCommandEnabled('Delete');
document.queryCommandEnabled('Delete');
mni_Paste.Enabled:=
document.queryCommandEnabled('Paste');
document.queryCommandEnabled('Paste');
mni_selectAll1.Enabled:=
document.queryCommandEnabled('SelectAll');
document.queryCommandEnabled('SelectAll');
end;
如果不用这个用不专业的办法做
1 用消息捕获
2 放在一个Timer事件下面
3 放在Application.OnMessage下面
正解
Ctrl
OnContextPopup
OnPopup