NextPrevUpTopContentsIndex

18.5.3 Saving code

There are several ways to save the code generated by the Interface Builder into files of source code. Any files that you save are also displayed as buffers in the editor.

Choose File > Save or click to save the current interface. If it has already been saved to a file, the new version is saved to the same file. If the interface has not been saved before, you are prompted for a filename. After saving, the file is displayed in the editor.

Choose File > Save As... to save the current interface to a specific file. This command always prompts you for a filename; if the interface has not been saved before, this command is identical to File > Save , and if the interface has already been saved, this command saves a copy into the file you specify, regardless of the file it was originally saved in. After saving, the file is displayed in the editor.

Choose File > Save All to save all of the interfaces that have been modified. A dialog allows you to specify precisely which interfaces to save. Choosing this command is analogous to choosing File > Save individually for each of the interfaces you want to save. If there are any interfaces which have not been saved previously, you are prompted for filenames for each one.

Choose File > Revert to Saved to revert the current interface to the last version saved.

Choose File > Close to close the current interface. You are prompted to save any changes if you have not already done so. The interface name is removed from the History > Items submenu.

Individual interface definitions are saved in an intelligent fashion. You can specify the same filename for any number of interfaces without fear of overwriting existing data. Interface definitions which have not already been saved in a given file are added to the end of that file, and existing interface definitions are replaced by their new versions. Source code which does not relate directly to the definition of an interface is ignored. In this way, you can safely combine the definitions for several interfaces in one file, together with other source code which might be unrelated to the user interface for your application.

Conversely, when loading interfaces into the environment (using File > Open or ), you do not have to specify filenames which only contain definitions of interfaces. The Interface Builder scans a given file for interface definitions, loads the definitions that you request, and ignores any other code that is in the file. See Loading existing interfaces for details on loading interfaces into the Interface Builder.

This approach to saving and loading interface definitions ensures that your working practices are not restricted in any way when you use the Interface Builder to design a GUI. You have complete control over the management of your source files, and are free to place the source code definitions for different parts of the GUI wherever you want; the Interface Builder can load and save to the files of your choice without failing to load interface definitions and without overwriting parts of the source code which do not relate directly to the GUI.


Common LispWorks User Guide (Windows version) - 21 Feb 2008

NextPrevUpTopContentsIndex