Cabbage Logo
Back to Cabbage Site

Creating custom UIs with Cabbage 3

Thanks, works great.

Is there any way to retrieve other properties for a channel, such as the range, bounds, etc.? Range being the most useful though.

Sorry for the late reply @hdale94, I’ve had a serious dose of flu all week. I’ll prepare an example for this when I get back on my feet.

1 Like

I just took a look at this now. The widget data, i.e, all widget properties should be sent to the plugin when it’s first loaded. It might be the case that the plugin is trying to send the data before the plugin UI has loaded, in which case the message are lost. So I’ve made sure they are added to a queue of messages tht get sent only when the ui opens. I’ve triggered a new build which should be ready shortly.

To intecept the properties you’ll need to update your code from before. The command is still named ‘widgetUpdate’, but there will be no event.data.value property. Instead, there will be a JSON object called data, so in your case it will be event.data.data. So you will need to update the following code to check for the existance of event.data.value.

if (slider) {
    switch (event.data.command) {
    case "widgetUpdate":
        slider.value = event.data.value;
        break;
    default:
        break;
    }
}

Here’s how I do it in my code: https://github.com/rorywalsh/vscabbage/blob/main/src/cabbage/widgetManager.js#L304 (keeping in mind JS in not my first language! :flushed: )