11.4Component Sequencing
As we just showed, calling is a modal interaction, that is, the method call:
doesn’t return until the component it called answers. That allows us to sequence component display.
ContactListView>>editContact: aContact
| view |
view := ContactView new.
view contact: aContact.
self call: view.
self inform: 'Thanks for editing ' , aContact name
Let’s suppose that you have redefined the method editContact:
as shown above. The method calls the view component and then, after the view answers, it displays a message. Here’s something to wrap your brain around. What if the user fills in the form, presses the Save button, then presses Back and changes the values in the form and saves again? After the first save, the above method calls WAComponent>>inform:
but when the user presses Back your method backs up into the call:
of ContactView
.
What Seaside does is the following: It snapshots the state of execution of your method so that it can jump back in response to the Back button. We’ll go into much more detail about this later in Section 11.8, For now just try it and confirm that things work as you’d expect.