Suppose you created the class ScreenPMCapture and implemented its methods. To now create
ScreenWinCapture and change the method
saveGraphicImage so it grabs BMPs for Windows tools, complete the steps given below.
|
3.
|
Select File Out from the Class menu. Or, if you are using a browser other than a Class Browser, select ScreenPMCapture and then File Out from the Classes menu.
|
The file contains the class definition for ScreenPMCapture and its private instance methods. The first set of text (or
chunk) contains the class definition. If
ScreenPMCapture were an extended class, instead of a defined class, the class definition would not be in the file. The second chunk is the Smalltalk expression
!ScreenPMCapture methods !. If the methods were
class methods, the expression would read
!ScreenPMCapture class methods !. The expression instructs the system to add the methods to the class
ScreenPMCapture. Because you filed out in the generic format, the expression does not indicate that the methods are private. The remaining chunks contain method definitions.
To create the class ScreenWinCapture and make the methods suitable for Windows, you must change the filed-out code as follows:
|
2.
|
From the Edit menu, select Find/Replace.
|
|
3.
|
In the displayed prompter, type PM in the Search field and Win in the Replace With field. You do not need to enter a replacement string. However, doing so means you can more quickly revise the code.
|
|
4.
|
Select Case Sensitive. Also, keep the default options of a forward and no-wrap search. 
|
|
5.
|
Select Find Next. Then, after the system finds the searched-for text and highlights it, select Replace/Find. The system replaces the current occurrence and finds the next one.
|
Alternatively, you can simply select Replace All. This option replaces all occurrences of the searched-for text throughout the file, without first giving you the chance not to replace specific occurrences of the text.
|
6.
|
Repeat step 5 until all three occurrences of PM are replaced with Win. After you change the last occurrence, clicking on Find Next causes the Find/Replace window to display Status: String Not Found along the bottom of the window.
|
|
7.
|
Click on Close to close the Search/Replace window.
|
|
9.
|
Pop up the Edit menu for the Workspace; then select Save.
|
Now, create the class ScreenWinCapture in your image by filing it into the subapplication
DevelopCaptureWin. (
Example: Defining application lineups for OS/2 and Windows describes how to create
DevelopCaptureWin. If you have already created
DevelopCaptureWin and
ScreenWinCapture, but want to complete this example, create another subapplication of
DevelopScreenCapture to file the code into. Name it, for example,
DevelopFileInTest. You can delete the subapplication after you file in the changed code and examine its contents.)
Copyright 2005, 2019 Instantiations, Inc. All rights reserved.