I am stuck on the same thing: a custom element that can control two parameters.
I derive a custom view class MyView from CView. In the construtor I pass a pointer to the VST3Editor:
class MyView : public CView
{
public:
AAView (const CRect& size, Steinberg::Vst::EditController* listener = nullptr);
// ...
private:
Steinberg::Vst::EditController* editController;
// ...
}
In the UiDescriptionEditor I place a CView and set the custom-view-name to “MyView”.
This triggers a call of Controller::createCustomView() and I can construct MyView:
VSTGUI::CView* Controller::createCustomView (UTF8StringPtr name,
const UIAttributes& attributes,
const IUIDescription* description,
VST3Editor* editor)
{
if (UTF8StringView (name) == "MyView")
{
myView = new MyView(CRect(), this);
return myView;
}
return nullptr;
}
MyView can then inform the Editor about value changes for different parameters:
// in MyView::onMouseDown():
editController->beginEdit(tag);
// in MyView::onMouseMoved():
editController->performEdit (tag, value);
editController->setParamNormalized (tag, value);
// in MyView::onMouseUp:
editController->endEdit(tag);
Do I understand it right: performEdit() informs the host and setParamNormalized() updates the editor?
For the other way round (MyView receives parameter changes) I guess I have to add MyView as listener to the two parameters.
In the sdk I see only code that is related Parameter Listener with CControls.
How can this be done? Can someone point me to the right direction?