Page 295 -
P. 295
text entry
Read data from the GUI
Think about the GUIs you’ve created so far. Those apps ran code in response
to events generated by users clicking buttons. So what’s different here? Well, in
addition to generating events, your users will also be creating data.
You need to do two things:
1 You need to create an interface with places to enter text.
The Head-Ex design shows exactly what the interface will need to look
like:
Depot:
Description:
Address:
Save
2 You need some way of accessing that information.
The data will need to be stored away in a file, so you need some way of
asking the interface what text has been entered. That way, when
someone clicks on the Save button, you’ll be able to write the data to
the deliveries.txt file, like this:
Depot:
You will need to APPEND this
information to the file whenever Seattle, WA
someone presses “Save." Description:
Books
The format of the file Address:
1 Main Street
doesn't matter, as long as
the depot staff can read it. Anytown
WA
260 Chapter 8