How to uniquely identify a view in verifyView

I am in the final stages of building a VST3 plugin, and I must say I’ve been very impressed with the API and with VSTGUI. One thing I’m not sure about though is I have a settings page that has some CTextLabels on it and I want to have a reference to them in my controller so I can update them on load, and when the user takes certain actions. My UI is created through the .uidesc file.

I originally gave them all unique tags and differentiated them that way, which worked on macOS, but seemed to crash on Windows. I assume maybe because the tags weren’t actual parameters, just numbers I was setting. So I’ve resorted to temporarily giving them all unique titles which I can look for in verifyView but that feels very fragile, because every time I save the view from the GUI editor, I’m going to end up with all those title’s replaced with whatever is currently in the labels.

There must be a better way to do this I’m missing? Eg: how do I uniquely identify a view in verifyView?

One possible way is to give the controls a custom-view-name and then you can check for it in verifyView:

//------------------------------------------------------------------------
CView* MyController::verifyView (CView* view, const UIAttributes& attributes, const IUIDescription* description)
{
	if (const auto attr = attributes.getAttributeValue (IUIDescription::kCustomViewName))
	{
		if (*attr == "TextLabel1")
		{
			//
		}
	}
	return view;
}
1 Like

That works. I had assumed setting that field would attempt to load some kind of custom view by name, which is why I avoided it.