|Version 19 (modified by mikel, 8 years ago) (diff)|
Building the User Interface
The next step in creating a Lisp version of the currency converter application is to construct the user interface. Apple's tutorial describes in detail how to do this.
Apple's tutorial explains how to use InterfaceBuilder to create the user interface, and how to use XCode to create project files and write Objective-C code. Our project uses Lisp instead of Objective-C, and does not use XCode project files, so you can skip the part of Apple's tutorial that explains how to use XCode.
Using InterfaceBuilder to Create the UI
We'll begin by using Apple's InterfaceBuilder application to create a nibfile. The nibfile contains archived versions of the Objective-C objects that define the application's user interface. When you launch an application, Mac OS X uses the archived objects in the nibfile to create the windows and menus you see on the screen.
Start by locating Apple's InterfaceBuilder application. If you installed Apple's Developer Tools, InterfaceBuilder should be in the folder "/Developer/Applications/?":
NOTE: If you have not installed Apple's Developer Tools, you should do that now. You will not be able to build the CurrencyConverter example without them. The Developer Tools are distributed as an optional install with Mac OS X 10.5 ("Leopard"). Look for the "XCode Tools" package in the "Optional Installs" folder on the Mac OS 10.5 install disk.
Once you have located InterfaceBuilder, double-click to launch the application. InterfaceBuilder presents a window you can use to choose a template for the nibfile you are going to create.
Click the "Application" icon and then click the "Choose" button to create an application nibfile. InterfaceBuilder creates a new application nibfile, but doesn't immediately save it. The Objective C objects that represent the new application's interface appear in a new untitled window:
The intial window and menubar also appear on the screen. The new application's name appears in the menus as "NewApplication". Save the new nibfile into the "currency-converter" folder that you created earlier (on this page). InterfaceBuilder 3.0 gives you a choice of file formats when you save a new nibfile; use the "NIB 3.x" format—the "XIB 3.x" format works fine for editing your user interface, but will not work correctly if you try to use it in a working application. Give the new file the name "CurrencyConverter.nib".
NOTE: Most Objective-C application projects use a main nibfile called "MainMenu.nib", and if you use XCode to create a new application project, it creates a nibfile with that name. Apple's CurrencyConverter tutorial assumes that the name of the main nibfile is "MainMenu.nib".