Class A - is the “container” that is the only PUBLIC object, so any properties (colors, fonts etc) are exposed here… and setting appropriate properites on the internal items is fine
Class B and C are both “canvas” type views, click events etc are sent to Class A via protocol delegates
Class D is a ScrollView
Class E is a TextView
Swift Menu events (ie. EnableMenuItems) are required to be at the level where the actions (cut,paste etc) would happen, this would be Class D
The problem I am facing is the best way for Class E to “know” about various properites of Class B and C (are they visibile, amongst other things). Espeically since Class A is the parent of all the instances.
The only way so far, is to create variables OUTSIDE class A that are public, and that is not a good practice, nor is having a given class hold a reference to an instance of antoher class
in Xojo you might use an Event in B C D and E that could be implemented in A for those to get / send information to / though A to other views
Dunno if you have that kind of facility
The other possibility is to use messages or notifications within the app to say “hey something changed” and then have one of the views respond to that notification (it might still have to call an exposed method on the other object to do this though)
Hmmmm… how about if I added an attribute to B, C, D and E that was a weak reference to “A”… and then use that to query everything? Technically each class would refernce to another class, but only indirectly…
The controller is a parent
The children have a reference to the parent?
Public properties of the parent could be set by the children, and read by other children.
Akin to properties of ‘app’ object in a Xojo app…?
That is fine for events (which I handled using delegates)… it is when it need to reach into another class instance and get a property value.
I just added a property to each of the classes called “parent” which is the class that it would need to query later on… so far this is working perfectly. Probably would not be a great solution if these were all generic reusable classes, but they are very specific and of no use outside the bounds of “Class A”