[fpc-pascal] More help with unicode

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sat Nov 10 16:23:01 CET 2007


Hello,

I still have some issues with unicode support =) I am trying to
implement unicode support for TMemo, but somehow the solution isn't
simple.  TMemo will throw a WM_SETTEXT message to when it's text is
set, like this:

    SendMessage(fHandle, WM_SETTEXT, 0, LPARAM(TheText));

Which I tryed to convert to:

    if UnicodeEnabledOS then
      SendMessage(fHandle, WM_SETTEXT, 0,
LPARAM(PWideChar(Utf8Decode(TheText))))
    else
      SendMessage(fHandle, WM_SETTEXT, 0, LPARAM(PChar(Utf8ToAnsi(TheText))));

But this doesn't seam to work, and the text is shown scrambled.

I would think that the control wasn't create with unicode functions,
but this is impossible because handle creating is centralized and all
other controls work normally, setting the same text to them.

I already debugged and execution flow does go throught that part.

There is just something about using WM_SETTEXT to set the text of a
control which escapes me.

Any ideas?

thanks,
-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list