Example: Defining application lineups for OS/2 and Windows
This example assumes that you have made the application DevelopScreenCapture. (See Example: Using TrailBlazer to create DevelopScreenCapture.) Because DevelopScreenCapture contains a method that uses a platform-specific class, the instructions for making DevelopScreenCapture show how to define classes for both OS/2 and Windows, namely ScreenPMCapture and ScreenWinCapture. The catch to this arrangement is that you have to ensure that you use the correct class for your system.
You can ensure that you use the correct class by defining an OS/2 lineup for OS/2 classes in DevelopScreenCapture and, similarly, a Windows lineup for the Windows classes. For this example, the lineups contain the following components:
Application DevelopScreenCapture
Class DevelopScreenCapture
Subapplication DevelopCapturePM (uses expression testing for OS/2)
Class DevelopCapturePM
Class ScreenPMCapture
Method saveGraphicImage (uses CgPMBMPFileFormat)
. <all other methods remain the same>
Subapplication DevelopCaptureWin (uses expression testing for Windows)
Class DevelopCaptureWin
Class ScreenWinCapture
Method saveGraphicImage (uses CgWinBMPFileFormat)
. <all other methods remain the same>
Creating the subapplications DevelopCapturePM and DevelopCaptureWin
To define the lineups, begin by creating two subapplications: one for OS/2 and one for Windows.
1. Open an Application Manager.
2. Select DevelopScreenCapture.
3. From the Applications menu, select Create > Subapplications.
4. In the prompter displayed, type the name of the subapplication for the OS/2 lineup: DevelopCapturePM; then select OK. The subapplication name is now shown, indented, below DevelopScreenCapture.
Repeat the above steps, except for step 4 name the subapplication DevelopCaptureWin.
Moving platform-specific classes to the subapplications
Next, complete the subapplications by moving and then releasing the appropriate classes to each. If you did not define both ScreenPMCapture and ScreenWinCapture when you completed Example: Defining the classes ScreenPMCapture and ScreenWinCapture, do so now.
To move ScreenPMCapture to the subapplication DevelopCapturePM:
5. From the Application Manager, select the application DevelopScreenCapture and its class ScreenPMCapture.
6. From the Classes menu, select Move.
7. From the displayed list of available target applications, select DevelopCapturePM; then select OK.

Target application
Repeat the above steps for the subapplication DevelopCaptureWin, except move the class ScreenWinCapture to DevelopCaptureWin.
Releasing the classes to the subapplications
To ensure that the classes load with the appropriate subapplication, for each subapplication:
1. Select the subapplication and both of its classes. For example, select DevelopCapturePM and then its classes DevelopCapturePM and ScreenPMCapture.
2. If both classes are versions, select Release from the Classes menu. If one or both classes are editions, select Version/Release All.
At this point, the Application Manager resembles the following when you select DevelopScreenCapture:
Application Manager
Specifying Boolean expressions for the lineups
Now that you have subapplications for each platform, assign to each subapplication a Smalltalk expression that evaluates to true only when a system is using the appropriate platform:
1. Open an Application Editions browser.
2. From the list of applications, select DevelopScreenCapture and the edition. Note that the expression displayed in the lower left pane is true.
3. From the Expressions menu, select Add.
4. In the displayed prompter, type the following expression for the OS/2 lineup:
System vmType = 'ES' and: [(System subsystemType: 'CW') = 'PM']
5. Select OK.
Repeat the above steps, except for step 4 enter the following expression for the Windows lineup:
System vmType = 'ES' and: #('WIN32s' 'WIN-NT')
includes: (System subsystemType: 'CW')]
Next, delete the expression true:
1. Select true.
2. From the Expressions menu, select Delete.
3. Confirm the deletion by selecting Yes in the displayed prompter.
Testing lineup expressions in a Workspace
Now that you have expressions for the lineups, test them by displaying them in a Workspace. It is essential that only one lineup expression return true. All other expressions must return false.
The following graphic shows that, on a Windows system, the Windows expression displays true and the OS/2 system displays false.
Platform expressions
This indicates that the expressions should work as desired and use only subapplication DevelopCapturePM if the platform is OS/2.
Releasing prerequisites
Note that when you added the lineups, the prerequisite DevelopmentWidget and its released edition name "disappeared" from the middle and lower right panes. For the subapplications to load successfully, you need to reinstate DevelopmentWidget as the prerequisite:
1. Select a configuration expression, such as the OS/2 lineup expression.
2. From the Prerequisites menu, select Add.
3. From the displayed list of available prerequisites, select DevelopmentWidget; then select OK.
The prerequisite name is shown in the browser.
Repeat the above steps, except for step 1 select the other lineup expression.
Releasing platform-specific subapplications
Next, complete steps that are similar to the steps for releasing prerequisites. However, this time release the subapplications to DevelopScreenCapture:
1. Select a configuration expression, such as the OS/2 lineup expression.
2. From the Subapplications menu, select Add.
3. From the displayed list of available subapplications, select DevelopCapturePM and the edition; then select >> and OK.
Repeat the above steps, except for step 2 select the other lineup expression. And for step 4, select DevelopCaptureWin.
At this point, with the subapplication expression for Windows selected, the Application Editions browser resembles the following:
Subapplication expression
Ensuring that DevelopScreenCapture loads
The lineups for OS/2 and Windows should now be functional. To test them, try loading DevelopScreenCapture:
1. From an Application Editions browser, select DevelopScreenCapture and the edition that contains the lineups.
2. From the Editions menu, select Load.
Loading from an Application Editions browser enables changes that you have made to the configuration for DevelopScreenCapture, which is in the library, to take effect in your image. You can check in an Application Manager to see if these changes took place. If DevelopScreenCapture loads successfully, its subapplications should be displayed without a > beside them. A > denotes that the subapplication has not been released to its containing application. Thus, if the load was successful, both DevelopCapturePM and DevelopCaptureWin should not have the >.
If the load was not successful, check any messages displayed in the Transcript. Also, examine the lineups in an Application Editions browser to ensure that the expressions are correct and that the appropriate prerequisites and subapplications are released to the lineups. Make any needed changes, then try to load again.
Finally, try loading DevelopScreenCapture from a system running on the other platform.
As with the other example applications in this guide, you can open an instance of ScreenPMCapture or ScreenWinCapture using DevelopChooser. (See Making your own applications.) However, because the classes ScreenPMCapture and ScreenWinCapture are platform-specific, DevelopChooser needs to open an instance of the correct class for the platform being used.
To change DevelopChooser so it opens an instance of ScreenPMCapture on an OS/2 system and an instance of ScreenWinCapture on a Windows system, repeat the above steps to define OS/2 and Windows lineups for DevelopChooser. For the OS/2 lineup, have the method addApplicationsToList open ScreenPMCapture. For the Windows lineup, have the method open ScreenWinCapture
Replacing subapplications in a lineup
To release a subapplication edition or version into many lineups of an application, when the application already contains the subapplication, do the following:
1. Open an Application Editions browser.
2. From the list of applications (or the list of subapplications), select the application (subapplication) to which you want to release the subapplication.
To view a list of subapplications, select the Application Names push button. A list of subapplications in the library is displayed (upper left pane).
3. Select the application (subapplication) edition or version.
4. From the list of configuration expressions, select the expression for the lineup that you want to modify.
5. From the list of subapplications (lower middle pane), select the subapplication that you want to release.
6. From the Subapplications menu, select Release Other. A window is displayed, listing all editions and versions of the subapplication.
7. Select a subapplication edition to replace the edition currently in the lineup; then select OK. The subapplication edition is released to the lineup.
8. Repeat steps 4 through 7 for each additional lineup that you want to modify.
Last modified date: 05/19/2020