29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

maintain a large number of images, then you c<strong>an</strong> create file outs which will allow you to construct the<br />

images you require, when you require them.<br />

You c<strong>an</strong> file out a whole class category, a class, a message protocol or a single method. This is done<br />

by selecting “ file out ” from the right mouse button menu (middle mouse button on a three button<br />

mouse) in the appropriate w indow from the System Browser (or one of the other available browsers,<br />

e.g. the excellent Full Browser).<br />

15.3.2 File in<br />

Figure 15.2: The File List tool<br />

If at a later stage you wish to “file in ” a “file out” file, you c<strong>an</strong> do so using the file tool. This tool is<br />

accessible from the VisualWorks Launcher by clicking on the filing cabinet icon. This presents the user<br />

with a (very) basic file editor.<br />

To view files, type into the top p<strong>an</strong>e of the file editor th e appropriate path (if required) for your host<br />

system, followed by either a specific name or a wild card.<br />

The list of files will be displayed in the middle p<strong>an</strong>e of the file tool. If you select <strong>an</strong>y of these files,<br />

their contents will be displayed in the bottom window. If the files are very large the system will ask you<br />

whether you really w<strong>an</strong>t to see their contents or whether just information on the file (such as its size)<br />

will do. You would use the right (or middle) mouse button to file in one of the files. If you do file it in,<br />

then a trace of what is being loaded (<strong><strong>an</strong>d</strong> compiled) will be printed in the system Tr<strong>an</strong>script window.<br />

Once the load is completed, if it is successful you will be able to view it using the System Browser.<br />

Note that if you have loaded in a whole class category, you will not be able to view it until you select<br />

update in the category p<strong>an</strong>e of <strong>an</strong>y open browsers, or you open a new browser. Figure 15.2 illustrates<br />

the file list tool being used to examine the contents of a file called Example.st. This file contains the<br />

source of a simple example class.<br />

If a file is selected <strong><strong>an</strong>d</strong> displayed in the bottom window, then you c<strong>an</strong> edit that file <strong><strong>an</strong>d</strong> save the<br />

ch<strong>an</strong>ges you have made. You c<strong>an</strong> also select part (or all) of t he file <strong><strong>an</strong>d</strong> then use the “do it” or “print it”<br />

options to execute that selected code. This c<strong>an</strong> be a very useful feature.<br />

Note that you c<strong>an</strong> also file in source code under programmatic control. To do this you need to send<br />

the message fileIn to a file. For example:<br />

'example.st' asFilename fileIn.<br />

124

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!