G
Guest
I have been perplexed by how to best treat an event that spans different
classes.
For example, I have a form which a user inputs data. I want to broadcast
that data via an event to another class (seen globally) having a data
structure which saves that form data to disk.
Whenever the form updates the data I'd like to broadcast the information and
have it saved in my global data structure. The perplexing thing for me
though is the "listener" object. The listener is instanciated in the class
containing the global data structure which saves to disk. However, I don't
have the "requestor" instanciated here. It is instanciated in the form where
the data is updated. But, the "listener" needs as a parameter input the
"requestor". How to I use events to send data from one form to another when
the listener and requester don't have scope to each other?
classes.
For example, I have a form which a user inputs data. I want to broadcast
that data via an event to another class (seen globally) having a data
structure which saves that form data to disk.
Whenever the form updates the data I'd like to broadcast the information and
have it saved in my global data structure. The perplexing thing for me
though is the "listener" object. The listener is instanciated in the class
containing the global data structure which saves to disk. However, I don't
have the "requestor" instanciated here. It is instanciated in the form where
the data is updated. But, the "listener" needs as a parameter input the
"requestor". How to I use events to send data from one form to another when
the listener and requester don't have scope to each other?