Best way to access GUI elements?

What is the best way to access GUI elements from code? I used to remember pointers, but this makes problems when user opens more than one window (I saw this in Steinberg Test host)

You should use controllers per window which have bi-directional connections to your model.

Hello Arne
What when I need some processing/calculation in my code?
Example: I need to multiply GUI input by sampleRate or BPM. To make it simple lets say I have my BPM or SampleRate variable in controller class.
I used to do this by remembering pointers in verifyView and by accessing the GUI elements by pointer. I know about the processor/controller parameter connection, but I can’t do this with the example.

Hi, this is not about the VST processor/controller pattern. This is about the MVC (Model-View-Controller) pattern.
Your model (BPM and SampleRate, etc) is inside your Vst::IEditController. Now when a view is created you have to create a new instance of a controller (if you use VSTGUI look at the IController interface) that manages the connection between your view and your model. If a second view is created, you create another controller instance to handle it.