Blocking copy / Ctrl-C on a grid

I've hear that this request is often asked.

So there is a little piece of code to block all copy of data in a grid (for all form)

If you want to do this only on one form, you need to overwritte the method taks in the form

 

For my case, you need to select the method "task" on the class "SysSetupFormRun' and write this:

 

FormControl form;

//standard code

if (_p1 == #taskCopy)
{
    form = this.control(this.selectedControl().containerId());

    if (form && form.handle() == classNum(FormGridControl))
    {
        return 0;
    }
}

ret = super(_p1);

return ret;

 

Disclaimer:Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This mail message assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures.