Windows inter-communication and static var - Question


#1

Hi,

I’m developping an Photoshop-like application, with multiple DocumentWindows, one for transport, one for Midi devices management, etc.

My problem is about static vars. When I modify one from one of my windows, none static value has been modified for the other ones. If my Window A says “now mouse is a wave editor pen, thus set the “static var mode” from 1 to 2”, all the other windows stays on the 1 value.

Another exemple : I want to make my windows communicate between each other.
I’ve thought of two ways for it :

  • to create a windows manager, probably better than…
  • to make a static list of windows address, in order any window to acces to one another. (what I did)

this time again, the static var of addresses, used to point to any window from any other one, is just 0 for all windows. Despite I specified value in these static var in the very launching of the app.

Any help would be gratefully accepted.

Thank you.


#2

In brief:

  • don’t use static variables.
  • learn about the changebroadcaster class
  • learn about model/view/controller patterns

#3

Thankyou.

Where can I find a releavant “use” of ChangeBroadcaster in JuceDemo or Jucer please ?


#4

search for “changebroadcaster”, and pretty much every instance you find will be relevent!


#5

hehe, thks