The Jucer (I am referring to the UI component designer here) is really a helpful tool to quickly sketch a user interface and refine it over time. The only issue I have is that I need to be extremely cautious to not loose any of the custom code I am having inside the component. I understand how the square brackets work, but still there is a permanent uncertainty and extra level of required awareness left that adds to the overall stress a lot.
Especially when changing a layout significantly, it is not guaranteed that all of those “custom regions” are retained, as, for instance, button names may change.
The perfect solution would be to isolate the files containing custom code from the Juce-maintained component machinery entirely. That is, the files Jucer works on will never need to be edited by the user. I am relatively new to C++, but from my overall experience, I could think of the following potential solutions:
:idea: (A) Make the custom component inherit from the Juce-generated class.
:idea: (B) Make the Jucer component a separate class, of which an instance is attached to the custom component as a member.
I don’t know how much overhead (B) would imply, concerning message delegation and such. Therefore my current favorite is (A).
What do you think?