Page 1 of 1

scope of "set useUnicode"

Posted: Thu May 12, 2011 10:01 pm
by sp27
I have read Devin Asay's article at /spaces/lessons/buckets/1412/lessons/20441-Unicode on typing and displaying Unicode in text entry fields, and I can do everything he describes. Thanks, Devin!

He never mentions storing Unicode text in variables and displaying it from variables, but that works, too. It should be added to the write-up.

What I don't understand is the scope of the statement "et the useUnicode to true."

Does it affect only the command that follows it, or the rest of the handler, or the current script, or the stack? Can I declare it after opening the main stack, and then use numToChar() and charToNum() anywhere in the application?

Grateful for any tips,

Slava

Re: scope of "set useUnicode"

Posted: Thu May 12, 2011 11:13 pm
by BvG
From the dictionary entry of "useUnicode":
Since the useUnicode is a local property, its value is reset to false when the current handler finishes executing. It retains its value only for the current handler, and setting it in one handler does not affect its value in other handlers it calls.

Re: scope of "set useUnicode"

Posted: Thu May 12, 2011 11:29 pm
by bn
Hi Slava,

from the dictionary:
Since the useUnicode is a local property, its value is reset to false when the current handler finishes executing. It retains its value only for the current handler, and setting it in one handler does not affect its value in other handlers it calls.
This means you have to set useUnicode explicitly in every handler where you want to use it. It is not a global property. Once it is set inside a handler it is in effect for the whole handler. You only have to set it once in a handler.If you do a custom function that you call from your main handler to do e.g. your conversion numtochar/charToNum you would have to set the useUnicode to true in that function.

Kind regards

Bernd


Edit:
Too late, Björnke already answered it.

Re: scope of "set useUnicode"

Posted: Fri May 13, 2011 10:01 am
by BvG
but your answer is better :)