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.

27.3 VisualWorks window painting tools<br />

Figure 27.1: The user interface builder <strong><strong>an</strong>d</strong> resource Launcher buttons<br />

The VisualWorks user interface builder is initiated using the c<strong>an</strong>vas tool button on the VisualLauncher.<br />

This button has a picture of <strong>an</strong> easel with <strong>an</strong> artist’s c<strong>an</strong>vas on it (see Figure 27.1). The user interface<br />

builder is comprised of three tools. These tools are the palette, which contains the elements to be placed<br />

on a window, the c<strong>an</strong>vas, which is the drawing area for the window <strong><strong>an</strong>d</strong> the c<strong>an</strong>vas tool, which allows<br />

the user to issue specific comm<strong><strong>an</strong>d</strong>s such as the installation of a window.<br />

The user interface builder in VisualWorks allows the user to create the window of <strong>an</strong> application<br />

from a wide r<strong>an</strong>ge of visual components. These visual components are available from the Palette <strong><strong>an</strong>d</strong><br />

include components such as buttons, text, sliders, tables <strong><strong>an</strong>d</strong> static visuals like rect<strong>an</strong>gles <strong><strong>an</strong>d</strong> lines.<br />

Using these components the user c<strong>an</strong> build up a window much in the same way as a diagram might be<br />

drawn in <strong>an</strong> object based drawing tool.<br />

The user interface builder also provides a set of layout options in the c<strong>an</strong>vas tool for relative <strong><strong>an</strong>d</strong><br />

absolute positioning <strong><strong>an</strong>d</strong> sizing, alignment <strong><strong>an</strong>d</strong> grouping of objects. Again this is done in a similar<br />

m<strong>an</strong>ner to that of <strong>an</strong> object based drawing tool.<br />

Figure 27.2 illustrates the window painting facilities being used to draw a modified VisualLauncher.<br />

On the left of the diagram is the Palette on which iconic versions of graphic objects are made available<br />

to the user. On the right of the Palette is the c<strong>an</strong>vas on which the l ayout of the window is drawn.<br />

Additional tools are available which allow the user to specify the properties associated with the graphic<br />

objects, for example, it is possible to specify what action should be performed when a button is pressed<br />

etc. The C<strong>an</strong>vas Control is displayed above the c<strong>an</strong>vas window. This window allows the properties of<br />

the c<strong>an</strong>vas to be specified.<br />

Figure 27.2: Creating a new Launcher using the window painting facilities<br />

It is also possible for the user to generate <strong>an</strong> actual working version of the window which has just<br />

been painted. This c<strong>an</strong> be done by first installing the window. This actually generates a class definition<br />

for the window. However, this is o nly the first step towards generating a functioning window. It is then<br />

necessary to create the appropriate methods for displaying <strong><strong>an</strong>d</strong> updating values displayed in the window<br />

<strong><strong>an</strong>d</strong> to produce stub methods for <strong>an</strong>y actions which should be associated with the gr aphic objects in the<br />

window. Such information c<strong>an</strong> be entered by the user via the definer option in the c<strong>an</strong>vas tool. This<br />

generates accessor methods for the variables referred to or stub methods for the actions entered earlier<br />

by the user. These stub method s must then be “filed out” with <strong>Smalltalk</strong> code using the st<strong><strong>an</strong>d</strong>ard set of<br />

browsers.<br />

224

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

Saved successfully!

Ooh no, something went wrong!