source: trunk/source/examples/cocoa/currency-converter/HOWTO_files/pages/build_app.html @ 8441

Last change on this file since 8441 was 8441, checked in by mikel, 12 years ago

final edits to currency-converter examples

File size: 5.4 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4  <head>
5    <title>CurrencyConverter HOWTO</title>
6    <link rel="stylesheet" type="text/css" href="../stylesheets/styles.css" />
7  </head>
8
9  <body>
10
11    <div class="title">
12      <h1>Building the Application</h1>
13    </div>
14
15    <div class="body-text">
16      <p>Both the user interface and the behavior of the
17      CurrencyConverter are complete now. All that remains for us to
18      do is to build the application executable into a Cocoa
19      application bundle. Apple's tutorial relies on XCode to build
20      the application from Objective-C source files; we will use the
21      Clozure CL IDE to build it from our Lisp source file.</p>
22
23      <p>We build the application using the optional
24      BUILD-APPLICATION feature, distributed as part of Clozure CL. The
25      steps to build the Cocoa application are:</p>
26
27      <ol>
28        <li><p>Load the application code into the IDE</p></li>
29        <li><p>Load the BUILD_APPLICATION feature</p></li>
30        <li><p>Run BUILD_APPLICATION with the proper arguments</p></li>
31      </ol>
32
33      <p>This sequence of steps causes Clozure CL to construct a Cocoa
34      application bundle and write out the application executable to
35      it, then quit. If all goes well, you should be able to run the
36      application by double-clicking it, and use the UI you built in
37      InterfaceBuilder to convert currencies.</p>
38    </div>
39
40    <div class="section-head">
41      <h2>Building the Application, Step-by-Step</h2>
42    </div>
43
44    <div class="body-text">
45      <ol>
46        <li><p>Launch the Clozure CL IDE. It's safest to build the
47        application with a fresh IDE session, so if you have it
48        running, you may wish to quit and relaunch before following
49        the rest of the steps.</p></li>
50
51        <li><p>For convenience, set the working directory to your
52        "currency-converter" folder. For example, you can do
53        something like this (using your pathnames in place of mine, of
54        course:):</p>
55          <p><code>(setf (current-directory) "/Users/mikel/Valise/clozure/openmcl/example-code/currency-converter/")</code></p>
56        </li>
57
58        <li><p>Load the application code:</p>
59          <p><code>(load "currency-converter")</code></p>
60        </li>
61
62        <li><p>Load the BUILD-APPLICATION feature:</p>
63          <p><code>(require "build-application")</code></p>
64        </li>
65
66        <li><p>Run BUILD-APPLICATION (be sure to correct the pathname
67        to your CurrencyConverter nibfile. It is safest to use a full,
68        absolute pathname&mdash;not the relative pathname you see
69        below):</p>
70          <p><pre>
71(ccl::build-application :name "CurrencyConverter"
72                        :main-nib-name "CurrencyConverter"
73                        :nibfiles
74  '(#P"currency-converter/CurrencyConverter.nib"))</pre></p>
75        </li>
76      </ol>
77
78      <p>By default, BUILD-APPLICATION constructs the application
79      bundle in the current working directory. If you followed the
80      instructions here, that means it will build
81      CurrencyConverter.app in your currency-converter folder. You
82      can control where BUILD-APPLICATION puts the application bundle
83      by passing a pathname as the value of the keyword argument
84      :DIRECTORY, like so:</p>
85
86          <p><pre>
87(ccl::build-application :name "CurrencyConverter"
88                        :directory #P"/Users/mikel/Desktop/"
89                        :main-nib-name "CurrencyConverter"
90                        :nibfiles
91  '(#P"currency-converter/CurrencyConverter.nib"))</pre></p>
92
93      <p>If all goes well, BUILD-APPLICATION constructs an
94        application bundle, copies "CurrencyConverter.nib" into it,
95        writes the application executable, and quits. You should now
96        be able to launch CurrencyConverter.app by double-clicking
97        the application icon:</p>
98
99      <div class="subtitle">
100        <img src="../images/cc1.jpg"alt="" 
101             border='0'/>
102      </div>
103
104      <p>CurrencyConverter.app launches and displays your user
105      interface, which you can then use to convert currencies:</p>
106
107      <div class="subtitle">
108        <img src="../images/cc2.jpg"alt="" 
109             border='0'/>
110      </div>
111
112
113    </div>
114
115    <div class="section-head">
116      <h2>Correcting the Application Name</h2>
117    </div>
118
119    <div class="body-text">
120      <p>You'll notice when you run the application that, even though
121      you named it CurrencyConverter, the name in the main menu
122      appears as "Clozure CL". That's because OS X takes the
123      application's name, not from the application bundle's name, nor
124      from the running code, but from an InfoPlist.strings file hidden
125      inside the application bundle. To make the name appear
126      correctly in the running application, you need to edit the file</p>
127
128      <p>CurrencyConverter.app/Contents/Resources/English.lproj/InfoPlist.strings</p>
129
130      <p>Find the entry named "CFBundleName" and change its value
131      from "Clozure CL" to "CurrencyConverter". The application's name
132      in the main menu bar should now appear correctly, as
133      "CurrencyConverter". You may also want to change the other
134      strings in the "InfoPlist.strings" file.</p>
135    </div>
136
137    <div class="nav">
138      <p><a href="../../HOWTO.html">start</a>|<a href="conclusion.html">next</a></p>
139    </div>
140
141
142  </body>
143</html>
144
Note: See TracBrowser for help on using the repository browser.