Remove/Autosort UI Components Using Code
-
HISE lets you decide how you want to go about setting up your interface. You can use the WYSIWYG editor, do it with code, or do a combination of both.
If you choose to do it exclusively with code, it's not entirely possible. You have to keep track of the element positions and hierarchy visually, and manually drag and drop any stragglers.
HISE seems to currently be missing the code methods to remove components or reset the list entirely so that when you recompile your script, the elements get sorted in order which they were called in.
I suppose this has something to do with persistence/saveInPreset?
Current frustrations with the code-only approach are:
- removal of elements not in use (when going for a code-only approach, this would be any component that does not have a reference).
- consistent sorting of elements in the list, which affects Z level and mouse interaction/focus
Being able to clear the component list at the beginning would result in a new one being created in the correct declaration order. If this has an interaction with the persistence system, then something else should be the way to go.
For removal, perhaps a method
Content.removeUnreferencedComponents()
, which would then be called at the end of the interface init script?For ordering, another method
Content.sortComponentsByCallOrder
that does the call order sort? That doesn't include removing them and interacting with the persistence system.