User's Guide
In the final part of this example, you'll create
platform-dependent leaf ICs. That is, you'll create two ICs that
each contain platform-specific code in the form of platform-specific
subapplications. In this part of the example, you'll use VisualAge
Smalltalk on both OS/2 and Windows, and thus will need access to development
environments on both these types of machines.
To begin, modify your To-Do List example application to make it platform
dependent. For example, add two subapplications, one for Windows and
one for OS/2, and modify slightly the behavior of Thing instance
method printOn:.
For more information on creating platform-specific subapplications, see Defining lineups for multiple platforms.
Now that you have an application with platform-specific code, create the
ICs in the following order:
- Windows leaf IC: winleaf.ic
- OS/2 leaf IC: os2leaf.ic
- In your Windows development image, load the applications
IcTestModel and IcTestView.
- Create a new edition of IcTestModel. Leave
IcTestModel selected in the VisualAge Organizer.
- From the VisualAge Organizer, select New from the
Applications menu.
- Enter IcTestModelWin for the application, and check the
Subapplication of checkbox.
- Select IcTestModelWin in the Organizer. From the
Parts full menu, select New > Extension.
For the class name to extend, enter Thing.
- Open Thing in the Script Editor.
- Select the method printOn:. From the
Methods menu, select Move > To a new
application. Select IcTestModelWin as the new
application.
- Change printOn: as follows:
printOn: aStream
aStream
nextPutAll: self name;
nextPutAll: ' thing on Windows'.
Your window should resemble the following. Notice in the status bar
that printOn: is now defined in
IcTestModelWin.
- Make sure you save the changes to printOn:. Close
the Script Editor for Thing. Version and release
Thing, in both IcTestModel and
IcTestModelWin. Version the subapplication
IcTestModelWin, but do not yet version
IcTestModel.
Now instruct VisualAge to load the IcTestModelWin
subapplication only if the platform on which VisualAge is running is Windows
- From the Tools menu of the Transcript or the VisualAge
Organizer, select Application Editions. The Application
Editions browser opens.
- In the far left pane, below the button labeled Application
Names, scroll down until you see IcTestModel, and select
it. In the Editions and Versions pane, select your open
edition.
- In the Config. Expressions pane, select
true; then display the pop-up menu. Select
copy. In the prompter which appears, enter the
following:
(System subsystemType: 'OS') = 'WIN32s'
You should execute this piece of code in a Workspace, display the return
value, and verify that it evaluates to true.
- In the Config. Expressions pane, select true
again. In the Subapplications pane, select
IcTestModelWin, display the pop-up menu, and select
Delete.
- Toggle the selection of the two items in the Config.
Expressions pane, and notice the difference.
When an application loads, the configuration expressions are evaluated in
the order they are listed, and evaluation stops when the first true
expression is encountered. The expressions instruct VisualAge to load
IcTestModelWin if the host platform is Windows; otherwise load
only IcTestModel with no subapplications. Next, add a
subapplication and configuration expression for the OS/2 platform.
The steps you follow for OS/2 are virtually the same as above.
- In your OS/2 development image, load the latest version of
IcTestView and your open edition of IcTestModel.
- Select IcTestModel in the VisualAge Organizer.
- From the Applications menu, select New.
- Enter IcTestModelOS2 for the application, and check the
Subapplication of checkbox.
- Select IcTestModelOS2 in the Organizer. From the
Parts menu, select New > Extension. For
the class name to extend, enter Thing.
- Open Thing in the Script Editor.
- Add the method printOn:, as follows:
printOn: aStream
aStream
nextPutAll: self name;
nextPutAll: ' thing on OS/2'.
Your window should resemble the following. Notice in the status bar
that printOn: is now defined in
IcTestModelOS2.
- Close the Script Editor for Thing. Version and release
Thing in IcTestModelOS2. Version the
subapplication IcTestModelOS2, but do not yet version
IcTestModel.
- From the Tools menu of the Transcript or the VisualAge
Organizer, select Application Editions. The Application
Editions browser opens.
- In the far left pane, below the button labeled Application
Names, scroll down until you see IcTestModel, and select
it. In the Editions and Versions pane, select your open
edition.
- In the Config. Expressions pane, select
true; then display the pop-up menu. Select
copy. In the prompter that appears, enter the
following:
(System subsystemType: 'OS') = 'OS/2'
You should execute this piece of code in a Workspace, display the return
value, and verify that it evaluates to true.
- In the Config. Expressions pane, select true
again. In the Subapplications pane, select
IcTestModelOS2, display the pop-up menu, and select
Delete.
- Toggle the selection of the three items in the Config.
Expressions pane, and notice the difference.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]