Say I have a Person class which contains a FirstName and LastName property. I then have a window showing people in a ListBox. Double clicking a person will open a new window to edit that person, it will contain two text fields. Now, when I edit the FirstName and press the Save button, what is the standard way to let the ListBox containing the person’s full name that things in the object have changed and it should update itself?
I originally created an event definition on the Person class named Updated. In limited testing this worked fine but then I found you could only bind to the Update event from one location. For example, say you add a third window that adds children to that person and in that window you have a static label showing the person’s full name. When editing that person in the Editor dialog you would want their name to update in the search results listbox as well as any other open window currently using that given person class.
Any hints and tips on how to accomplish this in Xojo? The only thing I can think of right now is my own event system where it keeps an array of delegates that want to be notified when the class is updated. Maybe I am missing something?
Recap:
Search Results (ListBox) contains many people displaying, one displaying “John Doe”
Person Editor dialog containing two TextFields editing “John” and “Doe” of the double clicked Person class
Another window opened from the Search Results of that same person, maybe showing “John Doe” in a Label widget providing the means to add children to that person.
When the editor is Saved, I’d like the Search Results ListBox to update with the new name as well as the “Child Editor Window’s Person Label” to update. i.e. the same class used in various places throughout my app. This is just a convoluted example, I wouldn’t make a person editor like that but in my real app things are much more complex, I have a Client class that is used in all sorts of various places and when the client is updated, I want everyone who is using the Client object to be able to update themselves.
Thanks!