[RESOLVED] Changing reference point twice on object with v1 compatibiltiy, second time x anchor does not get set

Hi, I’m using the v1 compatibility feature in the config.lua and am creating a text object, set the reference point of it to TopLeft and then placing it somewhere on the screen. Then after a few seconds I update the text using setText to a much longer string and then try reposition it again on the same place. Setting its reference point again to get the correct position of it and then place it on the same x/y values as before, but the X reference point doesn’t seem to get set.

I tried filing a bug report about it but I couldn’t even use the setText method when creating a brand new project, I got a “:setText is nil” error of some sort.

Anyone know what’s going on or if there’s a fix for this?

Hi @Skatan,

Based on the context (V1 mode), you must be using a Graphics 2.0 build? It’s possible (but I’m not sure yet) that “:setText()” will be deprecated in favor of the comparable “.text =’’” property in 2.0. Again, I’m not sure about this yet, but I will ask. In the meantime, can you try the “.text =’’” method and see if that works?

Thanks,

Brent

Hey Brent, thanks for the quick response. I did try the .text property as well but it gave me an error saying I was trying to access a string value, or something. Similar to if you’d use the .text property in a Graphics 1.0 build.

Edit: Also yes I’m using a Graphics 2.0 build.

Hi @Skatan,

The :setText() function is only supported by embossed text objects. That function does not exist for regular text objects created via display.newText(), whose text can only be modified via the “text” property/field.

Note that we’ve modified embossed text to support the “text” property in Graphics 2.0. This makes it consistent with regular text objects. This applies to Graphics 2.0 daily build #2014 and above.

Hope this helps,

Brent

Ah great, thanks now it works :slight_smile: Seems like :setText() works on my other project where I was experiencing the main bug I described and actually caused that bug, but changing it to .text = now fixes the referencePoint bug as well :slight_smile:

Thanks

Hi, Please help me I have this (statusText:setReferencePoint( display.CenterReferencePoint ))

van you give me an example of the correct way now in v2076?

Thanks.

Thanks, my App is working fine now.

Hi @Skatan,

Based on the context (V1 mode), you must be using a Graphics 2.0 build? It’s possible (but I’m not sure yet) that “:setText()” will be deprecated in favor of the comparable “.text =’’” property in 2.0. Again, I’m not sure about this yet, but I will ask. In the meantime, can you try the “.text =’’” method and see if that works?

Thanks,

Brent

Hey Brent, thanks for the quick response. I did try the .text property as well but it gave me an error saying I was trying to access a string value, or something. Similar to if you’d use the .text property in a Graphics 1.0 build.

Edit: Also yes I’m using a Graphics 2.0 build.

Hi @Skatan,

The :setText() function is only supported by embossed text objects. That function does not exist for regular text objects created via display.newText(), whose text can only be modified via the “text” property/field.

Note that we’ve modified embossed text to support the “text” property in Graphics 2.0. This makes it consistent with regular text objects. This applies to Graphics 2.0 daily build #2014 and above.

Hope this helps,

Brent

Ah great, thanks now it works :slight_smile: Seems like :setText() works on my other project where I was experiencing the main bug I described and actually caused that bug, but changing it to .text = now fixes the referencePoint bug as well :slight_smile:

Thanks

Hi, Please help me I have this (statusText:setReferencePoint( display.CenterReferencePoint ))

van you give me an example of the correct way now in v2076?

Thanks.

Thanks, my App is working fine now.