Dynamically create widgets

Hello!

is there a way to dynamically create widgets from the custom module?

thanks

Actually it could be enough for me just to be able to edit dynamically the HTML property of a widget from custom module, is it possible?

Of course answer was the listener in the property html linked to a variable in the custom module that changes…

There’s also the possibility to perform edit actions directly using remote control commands.

Thanks, I need to look at this solution too :slight_smile:

One question,
I was able to create dynamically objects using the HTML property, but this is limited to certain type of objects
If I want instead to initiate your widgets, what should be the right way of doing it?
thanks

When I need to do that I create an empty container widget in the session and feed its widgets property from the custom module:

receive('/EDIT', 'container_id', {
    widgets: [
        {
            type: 'fader',
            colorWidget: 'red',
            range: {min:0, max: 100},
            // omitted properties will use defaults
        }, 
        // etc
    ]
})

Here a more advanced example where I build generic plugin interfaces from the informations sent by the DAW : https://github.com/jean-emmanuel/ardour-control/blob/master/ardour-plugins-module.js

1 Like

Awesome thanks :slight_smile:

Thanks,
That works perfectly for me

I want to add widgets once when the application is launched, where is the right place to put this code?
I tried in the init() but it seems is invoked even before the panel is created so nothing happens.
The unload is only when the custom module is reloaded

Is there any method I can use?
Is there a list of methods that can be overridden in the custom module?

Thanks

You can use the app object to catch the relevant events. In this case:

app.on('sessionOpened', (data, client)=>{
  receive('/EDIT', id, widget_data, {clientId: client.id})
})
1 Like