Partager via


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.

Comments

  • Anonymous
    February 28, 2013
    Hi, Sebastien. I have a Question, Is it possible, to block only some fields from a form? thanks A lot .

  • Anonymous
    March 07, 2013
    Yes it's possible but you must know the Tech name of the fields. In the code I use this : this.selectedControl().containerId() The method selectedControl return the fields on which we are, so you need simply use this : (with ItemName as fieldName from SalesTable form)    if (_p1 == #taskCopy)    {        form = this.selectedControl();        if (form.name() == 'ItemName')        {            warning("Don't!");            return 0;        }    }