Page 1 of 1

copy contents of mle

Posted: Mon Feb 15, 2016 9:29 am
by bwolfsohn
Is it possible to copy contents of an mle that is editprotected ??

i'd like to right click to bring up a menu with copy as an option, but that doesn't seem possible.

Re: copy contents of mle

Posted: Mon Feb 15, 2016 9:45 am
by Tom

Code: Select all

@ n,n DCMULTILINE cText .... EDITPROTECT {||!lEdit} EVAL {|o|o:RbDown := {|x,y,z|IF(!lEdit,oMyMenu:PopUp(z,x,2,XBPMENU ...),nil)}}
"oMyMenu" maybe a DCMENU with only one item "copy". It will take the data (oMemo:GetData()) and copy it to the clipboard.

Re: copy contents of mle

Posted: Mon Feb 15, 2016 10:36 am
by rdonnay
EDITPROTECT will not even allow the MLE to gain focus, thus you can't use the mouse to copy contents.

If you want to protect from editing but still allow the mouse to work, try this:

Code: Select all

@ .. DCMULTILINE .. EVAL {|o|o:keyboard := {|a,b,o|o:undo()}}
Don't use the EDITPROTECT clause.