Android Question How to get Name of Control

emexes

Well-Known Member
Licensed User
Curiously, I was just working on something that requires that very ability. AFAIK it is not possible to get the name of the view object.

Usual workaround is to use tag field.

https://www.b4x.com/android/forum/t...object-in-getallviewsrecursive.93946/#content

There is a converter that reads the .bal layout file and converts it to a understandable format. Depending on your application, that might another approach.

https://www.b4x.com/android/forum/t...s-files-to-json-and-vice-versa.41623/#content
 

DonManfred

Expert
Licensed User

emexes

Well-Known Member
Licensed User
One idea I had was that, if all Views have an event handler name prefix, set when the object is initialized either directly or by LoadLayout, and generally this is the name of the object, then if it were possible to reach inside the view and get that prefix... bingo!
 

emexes

Well-Known Member
Licensed User
The name is not really important.
Sometimes it is. I am writing (well, trying to) a program to automatically generate designer scripts, that would be useful in all three of B4A/I/J, so if there was a way of getting the name programatically, that'd be extremely useful.

You should describe it more clearly what EXACTLY you are trying to achieve
+1

Always helps to know which direction the goal posts are in ;-)
 
Top