Child.Sub OutMsgI hope I interpret your setup correctly, but it looks like the flow is more or less:
What I do not understand is: you mention an UpdateButton message that the parent responds to,
But what triggers this message?
Typically, the parent does not know or care about child model contents or child model updates. The parent receives child messages, but parent does not read child messages. Parent simply passes the messages on to the child's update function, and stores the updated child model.
This separation guarantees that you can modify code in your child component (e.g. change the child model, add new message types etc), and any parent will continue to work properly. No need to check or change code in any other component that imports the child.
If any parent 'looks inside' the model or the messages of the child, then this guarantee breaks down.
The discussion here (or at least my interest in this) is:
How do I communicate a message from a child to parent, while at the same time maintaining the integrity of the child's model (so no peeking by parents into child model)?
Hi Rex,I hope I interpret your setup correctly, but it looks like the flow is more or less:
- user clicks a button inside child
- this triggers child's update function
- child's update function stores updates child model (with a message Click)
- the parent can then access the new function by accessing the child's model
What I do not understand is: you mention an UpdateButton message that the parent responds to,
But what triggers this message?
Typically, the parent does not know or care about child model contents or child model updates. The parent receives child messages, but parent does not read child messages. Parent simply passes the messages on to the child's update function, and stores the updated child model.
This separation guarantees that you can modify code in your child component (e.g. change the child model, add new message types etc), and any parent will continue to work properly. No need to check or change code in any other component that imports the child.
If any parent 'looks inside' the model or the messages of the child, then this guarantee breaks down.
The discussion here (or at least my interest in this) is:
How do I communicate a message from a child to parent, while at the same time maintaining the integrity of the child's model (so no peeking by parents into child model)?