Construction by direct manipulation
After 'Create Button':
The deposit: widget
|
Example of construction by direct manipulation
Let's build a simple interface to a bank account that mimics an ATM. We want to
withdraw and deposit specified sums of cash, and also have a "fast cash" button
that gives us a predetermined amount.
We'll start with the deposit and withdraw operations.
On the slot menu for the deposit: slot there is an item, `Create Button'. If we invoke
this, we get a small widget that allows us to specify an argument and send the
deposit: message. However, if we try to `Do it', we get a debugger. The widget is
sending deposit: to the traits.
To direct it at the bank account, we place it over the bank account object, and
invoke the `Set Target' middle-button menu. If we try the `Do it' button now, it
works.
We can now re-arrange this widget to be more realistic looking.
First, we want the `Do it' button labelled as `deposit:', and to the left of the editor.
To do this we rip the `Do it' label out and discard it, rip the existing deposit label
out and place it in the button, then move the button to where the deposit label used
to be. Finally we rip out the row that holds the `Get it' button and discard it.
|