On Dec 13, 2006 12:07 PM, Mark Nutter wrote
> --- Michael wrote:
> > In one editfield, I would like to implement copy but no paste,
> > as an example, while in the other ef I wold like to have paste
> > but no copy.
>
> Add 2 boolean properties to your window.  Call them NoCopy and
> NoPaste and have them both default to False.
>
> For the no-paste editfield, add code to the GotFocus and
> LostFocus events.  The GotFocus event should set NoPaste to True
> and the LostFocus event should set NoPaste to False.
>
> For the no-copy editfield, do the same, except the GotFocus event
> should set NoCopy to True, and the LostFocus event should set
> NoCopy to False.
>
> Now for the Window itself, in the EnableMenuItems event, add
>
>   EditCopy.Enabled = not NoCopy
>   EditPaste.Enabled = not NoPaste

If you're developing for Windows, be careful because just this will not prevent
copy/paste. Although the Edit menu items are disabled, users can still use
Ctrl+C (Copy) and Ctrl+V (Paste) on those editfields.
On Windows you have also to check on the KeyDown event for the Ctrl+C and Ctrl+V
to not allow the copy or paste.
But then you will have other problem: users can drop text on the editfields -
using a canvas over an editfied to get the drop does not work on windows.

Carlos

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to