Adding parts to the palette
When you first tested your timer part, you added it to the free-form surface by selecting Add Part from the Options menu. It's easier to add parts by selecting them from the parts palette, so you might want to add your timer part to the palette. This can be done in several different ways:
• From the File menu, select Add To Palette and then enter the name of the part.
• From the Options menu, select Modify Palette > Add Part and then enter the name of the part.
• Create the following class method in MyTimer:
addPartsToCatalog
"Add the timer to the Model category."
| category |
category := AbtPartsCatalog current categoryNamed: 'Models'.
category == nil ifFalse: [
category addPart: (self symbol)].
The preceding method is not called automatically unless the parts palette is rebuilt, so you must execute it from the Transcript window to make the part visible on the palette. In the Transcript window type:
MyTimer addPartsToCatalog
Then select the text and select Execute from the Transcript's pop-up menu.
The
addPartsToCatalog method adds the part to the Models category, but you could change the code to add it to any category. To learn more about adding parts to categories and creating your own categories, see
Loaded method examples.
Each category in the parts palette has a translatable name and an untranslated name. To locate a category, as you did in addPartsToCatalog you must use the untranslated name. To see a list of the available untranslated category names, inspect the following code snippet in a Workspace:
AbtPartsCatalog current catalog keys
To view the corresponding translated category names, inspect the following code snippet in a workspace:
AbtPartsCatalog current catalog values
collect: :each | each displayName]
Last modified date: 05/14/2020