主题:疯狂的VFPER之文本框右键菜单
VFP的文本框右键没有WINDOWS标准的复制、粘贴右键菜单,将以下代码加到文本框的RightClick事件中即可实现:
Release med_cut,med_copy,med_clear,med_slcta
Public med_cut,med_copy,med_clear,med_slcta
med_cut=Iif(This.SelLength>0,.T.,.F.)
med_copy=Iif(This.SelLength>0,.T.,.F.)
med_clear=Iif(This.SelLength>0,.T.,.F.)
med_slcta=Iif(Len(Alltrim(This.Text))>0,.T.,.F.)
Define Popup shortcut SHORTCUT Relative From Mrow(),Mcol()
Define Bar _Med_undo Of shortcut Prompt "撒消(\<U)" ;
KEY CTRL+Z, ""
Define Bar 2 Of shortcut Prompt "\-"
Define Bar _Med_cut Of shortcut Prompt "剪切(\<T)" ;
KEY CTRL+X, "" ;
SKIP For med_cut=.F.
Define Bar _Med_copy Of shortcut Prompt "复制(\<C)" ;
KEY CTRL+C, "" ;
SKIP For med_copy=.F.
Define Bar _Med_paste Of shortcut Prompt "粘贴(\<P)" ;
KEY CTRL+V, "" &&;
* SKIP For Empty(_Cliptext)
Define Bar _Med_clear Of shortcut Prompt "删除(\<D)" ;
KEY DEL, "" ;
SKIP For med_clear=.F.
Define Bar 7 Of shortcut Prompt "\-"
Define Bar _Med_slcta Of shortcut Prompt "全选(\<A)" ;
KEY CTRL+A, "" ;
SKIP For med_slcta=.F.
Activate Popup shortcut