the mouseText and Unicode
m.schonewille at economy-x-talk.com
Sat Jun 18 06:24:22 EDT 2011
Instead of simply pasting the text into LiveCode, do the following:
set the unicodeText of fld x to the clipboarddata["unicode"]
Now you can do this:
select the clickText
set the unicodeText of fld 2 to the unicodeText of the selection
or whatever you would like to do with the clickText. This works fine on Intel processors, I'm not sure wha happens if you try this on a PPC processor.
Economy-x-Talk Consulting and Software Engineering
New: Download the Installer Maker Plugin 1.6 for LiveCode here http://qery.us/ce
On 18 jun 2011, at 08:07, Slava Paperno wrote:
> Aha! The idea of using "the number of words" is brilliant.
> Unfortunately, the word boundaries don't "quite" work, and I think it's for
> the same reason: I think the mouseCharChunk reports bytes, not characters.
> It is Unicode-smart in some ways: when you click a non-Roman letter, it
> returns "char N to N+1 of field X." When you click a Roman letter in a
> double-byte field it returns "char N to N of field X."
> In this string, for example:
> Саша, Наташа, Митя, Роберт, Robert, Jeffrey, and Соня Петрова, Слава
> Паперно, Лора Баглай, Макс Паперно
> clicking on the first letter in word 4 returns 3 for the number of words.
> This is what I have in the mouseUp handler of the field:
> put word 2 of the mouseCharChunk into locStart
> put locStart && the number of words in char 1 to locStart of me
> Clicking on the space between word 1 and word 2 (the space after the first
> comma) displays 10 for locStart. It is indeed byte 10, but if the entire
> field were treated as double-byte text, it should be 11. So each Russian
> letter is counted as two bytes and two characters, but the comma is counted
> as one byte and one character. This screws up my math.
> Strangely, clicking anywhere other than the first letter of the fourth word
> in that sample string returns the correct word position.
> So I'm still in the dark.
> Thanks, Jacqueline!
More information about the Use-livecode