Dynamic user-customizable interface?

Voorjeweetmaarnooit's icon

Hello, and thanks for reading.

I'm writing some applications for M4L (The question is not really M4L related however), and one of the things that I am implementing is the easy ability to change the behaviour of the sound by simple javascripts (All the variables are max global objects, so creating a script that says "volume++;" will just continiously raise the volume (The rest of the software makes sure it loops or resets to 0.).

However, with this I also want to make it possible to add custom UI elements to the interface for controlling these custom scripts, i.e. being able to write "Speed = new Slider(0, 10, 0.1, 5);" which would create a new slider in the interface which goes from 0 to 10 in 0.1 steps and has a initial value of 5, and passes this value on to the variable Speed which is then useable within the user-written script.

I've currently written this quite awkwardly (I'm used to switching to written languages when things get complicated), where there's a set of UI elements that all pass on the variables, but are each hidden or shown depending on what the user defines within the script. The downside of this is that it's fixed, you can only use as much variables as I've pre-programmed, as to speak.

I've thought about doing this with JSUI, and actually drawing the UI elements when requested, which would allow more dynamic use of UI elements, but it would also be quite a chore and a potentially CPU-heavy, which I'm trying to avoid as the rest is already quite heavy.

In what way would I be able to do this the most efficient / best?