I found a way to change the module widget in the browser dynamically:
By overriding step()
on your module widget, you can change everything inside your module widget and its children at GUI frame rate.
By creating a DirtyEvent
and calling parent->parent->onDirty()
you set the FrameBufferWidget in the Browser that holds your module widget to dirty, so that it redraws iself and all its children (your module widget and its children).
In the video above, I randomly reload the SVG file and run a counter in a widget with a custom draw()
method.
Here’s a pseudo-code:
void MyWidget::step() {
if (!module) {
// update your child widgets here
// e.g. load an SVG file or change internal values
DirtyEvent eDirty;
parent->parent->onDirty(eDirty);
}
ModuleWidget::step();
}