Clipoboard not working after build 2.0.54

Answered
0
0

Hi all,

today we updated to last version of Wisej 2.1.42.

 

We have some problem with Clipboard.

Here the simple line that we are using:


Clipboard.SetClientText(textToCopy);

 

We noted that is not working in builds: 2.1.13 – 2.1.22 – 2.1.42

 

Thanks for any help.

  • You must to post comments
Best Answer
0
0

You are correct, sorry. I didn’t know that it worked also from the server side. It’s a regression caused by a change in the selection of the text in the elements – it used to grab the focus and now it doesn’t, which is correct but it broke the document.executeCommand(“copy”). Will fix. Do you need a workaround?

  • Simone Marconetto
    No thanks, we rollback to 2.0.54.0 and wait for a fix to update. Thank you!
  • You must to post comments
0
0

Hi Simone,

it´s fixed in Wisej release 2.1.43.

Best regards
Frank

  • You must to post comments
0
0

Hi Luca,
thanks for you answer.

Right now we are doing this operation in response of a user event, in particular when user double click a cell of a DataGridView.

Here the complete code:

        private void GridPratiche_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                int columnIndex = e.ColumnIndex;

                if (gridPratiche.SelectedRows.Count > 0 &&
                    gridPratiche.Columns.ElementAtOrDefault(columnIndex) != null)
                {
                    DataGridViewCell cell = gridPratiche.SelectedRows[0].Cells[columnIndex];

                    if (cell.Value != null)
                    {
                        string textToCopy = cell.Value.ToString();

                        Clipboard.SetClientText(textToCopy);

                        AlertBox.Show("Copiato il testo '" + textToCopy + "'" + Environment.NewLine + "Colonna " + cell.OwningColumn.HeaderText + ".",
                            MessageBoxIcon.Information, true, ContentAlignment.BottomRight, 2000);
                    }

                }
            }
        }

And why until version 2.0.54.0 is working fine ?

Thanks for your help.

  • You must to post comments
0
0

It is not enough to send the text to the browser, you need to copy it to the browser’s clipboard in response of a user event (a click). All browsers, except IE probably, block any access to the clipboard unless it’s directly initiated by a user action. That’s why all websites that copy text to the clipboard have a little copy button to click.

With Wisej you can send the text to the browser using Clipboard.SetClientText(textToCopy), then you can copy to the browser’s clipboard using Wisej.Core.copy() in response to a client click event. You can attach a client event using ClientEvents, add a “execute” handler and run Wisej.Core.copy();

See also:

https://wisej.com/support/question/copy-text-to-clipboard

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.