Page 1 of 1

Can't perform Unicode Operation - Error

Posted: Fri Apr 09, 2010 8:10 pm
by jnap
Hi

I am intermittently getting this Error Message in Delphi 2010 - "Can't perform Unicode Operation"

I have just switched from Delphi 2007 to Delphi 2010 and since before the switch never had this Error Message before: "Can't perform Unicode Operation"

Is there anything I can do to prevent this Error from happening? Please could you give me some advice as to what I can do?

All the best

jnap ( Chris ).

Posted: Fri Apr 09, 2010 8:19 pm
by Sergey Tkachenko
This error usually occurs when you try to call Unicode method for non-Unicode text item or non-Unicode string.
This is may be a result of conversion of your application to D2010: in D2010, all text items are Unicode by default.

Can you post which code raises this error?

Posted: Fri Apr 09, 2010 9:04 pm
by jnap
Hi

Thank you for your very fast response :)

The Error is just on a Paste from an rvActionPaste which is assigned to a TPopupMenu.

Thank you for your time

Chris

Posted: Sat Apr 10, 2010 2:45 pm
by jnap
Hi

Sorry for the confusion but I have now found the line causing the problem.

It is:

Code: Select all

//------------------------------------------------------------------------------
//  rve OnPaste...
//------------------------------------------------------------------------------
procedure TSEMArcFrm.rvePaste(Sender: TCustomRichViewEdit;
  var DoDefault: Boolean);
begin
  DoDefault := not PasteTextWithURLs(Sender, URLScanEvent);
end;

Posted: Sat Apr 10, 2010 6:41 pm
by Sergey Tkachenko
As I understand, you use the function PasteTextWithURLs from URLScan.pas from Assorted\Hypertext\URLs demo.
Just update this unit from DelphiUnicode\Assorted\Hypertext\URLs\