unicode text &u.... sometimes works

I have as the caption for a button &U25B6 or Black Right Pointing Triangle or “?” and it displays.
If I add to a string, which is defined as UTF8, the character hex representation &U21BE or “?” an upwards harpoon with left pointing barb, I get just “&U21BE” and not the “?”.
Why? I’ve read the LR section on literals, and the choice isn’t clear.

code showing how you’re adding it would be useful

Clarification. I have for the Prime1R, which is a string property, currently “?” in the default. I tried the hex &U21BE and didn’t get the barb but &U21BE.

KStr3 = Right(txt0, KRint) Kstr2 = Prime1L + KStr2 + Prime1R RCEdit(CtrlFocus).text = KStr1 + KStr2 + KStr3
Prime1R is the character above. Prime1L is the right one. They are global properties defined as encodings.UTF8 (I think that part is right)

If its a string I suspect the VALUE is actually “&U21BE” and NOT the character value you expect
But if this property is NOT actually something that will change at runtime use a constant

yes. that’d work. How do I put this into default value? I’m pretty sure without something else I’d just get Not the character

just put in
&u21be
it should work fine

That is my confusion. It didn’t work on the property. I doubt constant is any better.

You really should try it before saying it wont work

Before I begin, I did on the property and it didn’t work.
It worked on caption, and I defined that later.

Just try it

Sorry, but didn’t work either.
A string before adding my Prime1 constants

string after adding my Prime1 constants

I thought it might be different since the Propertys don’t have “” quotes around the default values.

Had to go look at why this is and … yeah … it wont work either but probably should
Sorry for the bum steer
Has to do with us writing constants as specific types now
Basically we used to write

    const Prime1 = &U21BE

but now write this as

    const Prime1 as string = "&U21BE"

This fixed a certain class of errors on compile (like when you wanted a TEXT not a STRING and there was no way to indicate this)

You CAN write a on line “const” like

    const Prime1 = &U21BE

at the top of the method where you want to use this though
The compiler will figure out the right type

Thank you.
That is annoying. I also tried the datatype text for a new experience of a datatype. Same response. Good luck on the compiler fix.
How do I declare by code a constant. My experience / understandiing is Nil. Where?
My constants would be global. Could it still be global?
The reason I’m asking is I learned recently to not declare them in the App but in a module.
If so by code How?

You can also do chr(&h21BE)

If you want it global, create a computed property in a module as global, and place this in the getter, nothing in the setter. It will do the same as a constant.

Return chr(&h21BE)

Do you know of an example in the “examples” of a computed property?

I just looked the term up on dev center and it didn’t show up easily.
I’ve stayed away from this term for too long.

  1. Insert a module in the project
  2. Right click the module, select add… / Computed property
  3. Set the computed property as Global

The computed property contains two methods : get and set. Get returns the value of the computed property, set allows setting its value.

That’s about it.

The nice thing about computed properties is precisely they are a form of methods, so you can perform more complex tasks than with regular properties.

Thank you. Perfect.
I see a lot of value there.

[quote=329348:@Arthur Gabhart]Thank you.
That is annoying. I also tried the datatype text for a new experience of a datatype. Same response. Good luck on the compiler fix.
[/quote]
Not a compiler fix at all

[quote=329348:@Arthur Gabhart]How do I declare by code a constant. My experience / understandiing is Nil. Where?
[/quote]
in code put it before you use it (I like to put local constants like this at the very first few lines)

    const Prime1 = &U21BE

No
Use a computed property if you need this to be global
Its the same as adding a constant but instead you put code in the “Get” that returns the value you want

    return &U21BE