ObjectInfo("name") troubles

I’m having trouble understanding how to make the ObjectInfo(“name”) function work & could use some guidance.
I have a text display object grouping, which I have given the names of integers, ie 1 or 14. I would like to use the objectinfo(“name”) to return that integer so I can use it for things like displaying an element in an array - Array(XArray, val(objectinfo(“name”)), “;”).
The blueprint says the name is what I think it is, but message objectinfo(“name”) returns a blank, while info(“trigger”)[-2, -1] returns the proper integer name.
Is there something different about objectinfo that I’m not aware of?
Thanks in advance,
Scott

It looks like there may be a bug here. In the documentation it says

If the objectinfo( function is used inside the formula for a Text Display, Image Display, Web Browser, Segmented Button or Tab Panel object, it can refer to object itself by using "«»" as the object name.

and that seems to work for properties other than the name, but to get the text display object to display the name, I need to use the actual name as the second parameter.

I would try to solve the issue by using text strings as object names e.g. “TDO1”, “TDO2” …

In my testing I tried naming the object “foo”. ObjectInfo(“name”,«») didn’t display anything, but ObjectInfo(“name”,“foo”) did display “foo”.

Try

objectinfo("name","«»")

That worked fine for me.

I’m not sure I read your question correctly. It isn’t clear to me whether you want to be using objectinfo( in the formula of the text display object, or you want a procedure that was triggered by clicking on it to retrieve the name. If it’s the latter, info(“trigger”) is the way to go.

Objectinfo( is normally used to return information about a selected object, or it is used in the formula of a selectobjects statement.

Using an object as a button doesn’t make it a selected object.

Or in that situation he could also use info(“clickedobjectname”) or info(“clickedobjectid”).

Yes. That works for me as well. I was fooled when it seemed to work without the quotes, when I tried another property (opacity), but I see now, that the number I was looking at wasn’t actually the opacity.

Thanks for the quick responses. I think I was looking at the objectinfo in the same way as others, like info(“trigger”), but it’s intended use is different.

I wanted both scenarios - as the object was refreshed, it would know its own name and be able to use that to calculate the element of an array to display on the fly. That would mean all the text display objects could use the same procedure code in the formula panel and only the name would need to be assigned. I can hard code each one, I had just hoped to figure out a way to reduce the tedium. I’m testing the speed of building my own calendar displays out of TDO’s, so there will over a thousand elements.

This will do nicely in the procedure code and passed on to be used by other processes.

You should be able to do that.

I don’t know about the performance of a thousand objects, though. Never tried anywhere near that number.

I don’t believe objectinfo works with grouped objects. (?)

I missed that detail in the original post. You are correct, objectinfo(“name”) doesn’t work if the object is nested into a group object. However, looking at the source code I think that

objectinfo("name","«»")

will still work even if the object is in a group – this is a special case and is handled differently.

Also info(“clickedobjectid”) should work ok even if the object is in a group.

So I think Scott is good to go.

Looking at the old source code commit messages, there is a mention that objectinfo(“name”) doesn’t work with group objects all the way back in 2014. It’s mentioned in the context of fixing this problem for the ChangeObject and ObjectAction statements, so perhaps there was some further problem in also fixing objectinfo(. 2014 was before the BitBucket system was set up, so this problem is not listed in BitBucket. I have now added this bug to BitBucket so that it hopefully won’t languish for another 6 years.