Set componentID in IntroJucer and ComponentBuilder documentation


is there a chance to set the componentID in the Introjucer when designing a GUI component? I use it to hook up a XML defined layout, so one can create the gui per mouse click. I could use componentName as well, but to retrieve the components I see the best method is findChildWithID.

Second question, is there a plugin mechanism I can use to add menus to the Introjucer? I want to instanciate the layout, group the lasso-ed components in a box layout and write the clicked layout in an xml file. Also to add the layout properties in the properties tab for the selected component would be great.

You can see, how a xml layout can be hooked into a component from IntroJucer here:

And third, where can I find information about how the ValueTree needs to be defined (i.e. type name and properties) to use them for the ComponentBuilder? I hardwired the Label class so I can define texts for knob names in the xml, without the need to have member variables. But I want to use the ComponentBuilder for that. I hope the TypeHandlers for the juce components are already present, aren't they? I could only find the Drawables, but are there specialisations?

Thanks for your help,


I just realized, that I might as well iterate over the components children and check for the componentName myself. Probably not much difference to findChildWithID. I already implemented it, so the introjuced component can be used without editing single items.

Leaves the question, what is the best way to enhance the introjucer with additional functionalities, and where I can find documentation on the ValueTree for ComponentBuilder:

to retrieve the components I see the best method is findChildWithID.

The best method of finding a component is always to just get a pointer/reference directly to it, not to search for IDs or names. Since in the introjucer's GUI buider all the components are member variables, there's not really much sense in searching for the ID of a component when it's sitting right there in the parent class and you can just refer to it.

Right, but the lookup is only done once, when the layout structure is loaded from a ValueTree (i.e. XML). Then -and only this one time- the components are looked up and store a Component::SafePointer to the components to manipulate them on further resizes or layout structure changes.

This makes it possible, that only two lines of code need to be copied and pasted into the introjucer created code to use a xml from the resources for definigng any layout, alignments and even additional text labels. Have a look at the example, it's quite nice, the XML:

And the three code lines (ok, it's four, I wrote the resource retrieving in an extra line for readability ;-) ):

// in the class definition:
    //[UserVariables] -- You can add your own custom variables in this section. 
    ScopedPointer<Layout> layout; 

// in the constructor:
    String xml = String::fromUTF8 (BinaryData::IntroJucedComponent_jui, BinaryData::IntroJucedComponent_juiSize); 
    layout = new Layout (xml, this); 

// in resized:
    //[UserResized] Add your own custom resize handling here.. 
    if (layout) layout->updateGeometry(); 


Any hint for the ComponentBuilder though?

Never mind: and similar. I was looking for Label and other higher level stuff, but this should do...

3rd question if additional functionality can be put into the Introjucer, let me know if there is any routine...