Identifying UI elements


#1

Hi all,

Some times I have the need to traverse the MainContentComponent in order to find out just the name of each child gui element (not the member name).

However I am receiving and some "internal" UI elements (i.e. in a slider I am also receiving and the text box as a separate UI element).

My question : Is there any unique characteristic to stand out these  "internal" UI elements;

 

Thanks in advance

 

George    


#2

In a debug version of tracktion at one point we had a little hack that used typeid to display the class names of the component stack that the mouse was hovering over.. It was fairly handy, and easy enough to write - I must add it to the library as a handy utility at some point.


#3

This would be great for testing and debugging UI stuff in JUCE - a bit like the browser developer modes where you can hover over an element and get all its info. Firefox is the best for this - shows you the elements bounds with ruler lines across the screen. 


#4

I think there is a misunderstanding.

I am using the LocalisedStrings ability to set a customized tooltip (and not only) for each separate UI compoment, where the typical line ("hello" = "bonjour") in the LocalisedStrings-file has the following form :

"UI name" = "tooltiptext"

So, with this trick, I can define tooltips in multiple languages, according to the region of the user.

However, at initialization phase, when I am trying to find out the name of each child UI element contained in the  setContentOwned-maincomponent,  I receive some "internal" elements as I explained in my first message.

So, is there any characteristic in order to reject these elements?

 

George

 

Edit : Ok!  I can handle the case in which the string (the UI element name) not found in the file.

The translate() function "If the string isn't found in the list, the resultIfNotFound string will be returned".

 

 


#5

I've finally made my component debugger into a separate juce module, which includes similar functionality.   You navigate a tree of components rather than hover over the existing ones.  It works better with overlapping components like that :) 

https://github.com/jcredland/juce-toys/


#6

:)