Moon Travel Planner: Handling Files

You’ve now built an application that allows users to plan trips to the moon. Planning how to get somewhere is helpful, but what do tourists do once they get to the moon? To make your application truly useful as a moon travel planner, you should help users plan their itineraries once they’re moon-side. In this section, you will add a new window to your application: the itinerary window, which will display a traveler’s vacation event schedule for the duration of a stay on the moon.

You will also save the contents of the itinerary window in a file, and retrieve the contents of existing itinerary files. If you were creating a fully featured, robust application, you would make the text of the itinerary file editable by the user; however, that would involve creating a text editor. Since we do not show you how to handle text editing in this book, we will use a read-only itinerary file. Using a read-only file, we can still implement the Open and Save As commands. Once your application can handle these commands, you will have implemented most of the file handling code that you would need in order to implement the other standard File menu commands, Save and New. We will note in the chapter the places where you would normally implement these other commands.

Note

To get a quick start on supporting text editing capabilities in your application, read the Multilingual Text Engine documentation in Carbon Help.

To add an itinerary to your Moon Travel application, ...

Get Learning Carbon now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.