Hello
This is a question about how to add a morph to the ObjectsTool. Some instructions are in the class comment it is too terse for me.
1. Flaps ---------------- There is red flap on to of the screen which is shown when flaps are enabled.
I'd like to add a new tool to the flap.
2. Adding a morph to the red flap ----------------------------------------------------------
The ObjectsTool manages the red flap. The class comment has instructions how to add a new morph type to the objects tool. [1]
3. Code to add to the class of the Morph to be added to the flap ----------------------------------------------------------------------------------------------
So I follow the instructions and implement a method
descriptionForPartsBin ^ self partName: 'TagTool' categories: #('Text') documentation: 'A tool which offers tags for projects'
in my on the class side of my class TagTool.
This is not yet sufficient to have an instance of TagTool appearing in the objects tool flap.
It seems that I have to call an initialisation method.
4. Question ---------------------
The methods #initializeToStandAlone and #authoringPrototype are mentioned. Do I need to use them, and if yes how?
Thank you for the answer in advance.
Hannes
------------------------------------------------------------------------------------------------------------------- [1] I am a Master Parts Bin that allows the user to drag out a new Morph from a voluminous iconic list.
Choose "objects" from the world menu, or type Alt-o (Cmd-o on the Mac).
To add a new kinds of Morphs: In the class of the Morph, implement the message:
descriptionForPartsBin ^ self partName: 'Rectangle' categories: #('Graphics' ' Basic 1 ') documentation: 'A rectangular shape, with border and fill style'
The partName is the title that will show in the lower pane of the Object Tool. When is categories mode, an object can be seen in more than one category. The list above tells which ones. Documentation is what will show in the balloon help for each object thumbnail. The message #initializeToStandAlone creates the actual instance.
To make a second variant object prototype coming from the same class, implement #supplementaryPartsDescriptions. In it, you get to specify the nativitySelector. It is sent to the class to get the variant objects. Often it is #authoringPrototype. (A class may supply supplementaryPartsDescriptions without implementing descriptionForPartsBin. This gives you better control.)
On Tue, Nov 8, 2016 at 5:20 AM, H. Hirzel hannes.hirzel@gmail.com wrote:
descriptionForPartsBin ^ self partName: 'TagTool' categories: #('Text') documentation: 'A tool which offers tags for projects'
Works for me. Adding this to the class side of your morph is enough to make it appear in the objects tool or flap. Just switch away from the 'Text' category, and switch back.
- Bert -
squeak-dev@lists.squeakfoundation.org