Project members: Annotation legend
With legend annotations you can add comments and hints to your project. As such the annotations are very useful for foreigner developers to understand what the implementation does. Legend annotation members appear in Composer as text boxes with a chamfered top-right corner:
The annotations have no effect on the application itself. They exist for descriptive purpose only. Annotations can be used everywhere within your project.
Annotations and inheritance
Unlike other members, annotations are not inherited when you derive a new class from a base class containing annotations. The annotations from the base class are simply ignored.
Add new legend annotation
★First switch to the Composer page you want to add the annotation member.
★Then, in the Gallery window, ensure that the folder Chora is opened.
★Look in the folder for the template named Annotation Legend.
★With the mouse, select the template and drag it into the Composer.
★Drop the template within the Composer.
Adding a new annotation member.
Arrange the annotation box
★First ensure, that the annotation member is selected.
★To move the entire annotation member click it with the mouse and move it.
★To resize the member, click with the mouse on one of its corners and move it.
★Alternatively, you can control the position of the annotation box by modifying its attribute Bounds.
Name the annotation
★First ensure, that the annotation member is selected.
★Press the key F2 or select the menu item .
★Enter the new name in the Inspector window.
The name of the annotation member has no effect on the function of your application. However, it has to be unique in its particular context.
Edit the text of the annotation legend
The text displayed within the annotation box is determined by its attribute Text. When you intend to enter a longer text, it is convenient to activate the menu option and edit the text directly within the Code Editor window instead of using the small input field in Inspector. In the Code Editor you can also enter multiline text for the annotation.
Duplicate an existing annotation
You can create any number of copies of an already existing annotation member.
★First ensure, that the annotation member is selected.
★Press the keys CtrlC and CtrlV in succession ...
★... or hold the key Ctrl pressed while you drag and drop the selected annotation member.
★Finally rename the just duplicated annotation member.
Delete an annotation
★First ensure, that the annotation member is selected.
★Press the key DEL or select the menu item .
Attributes of an annotation legend
The following table shows the complete list of attributes provided by the legend annotation member:
Attribute name |
Short description |
---|---|
Determines the position and the size of an annotation member box. |
|
Determines the text to display in the box of an annotation member. |
Chora syntax of an annotation legend
This section describes the Chora syntax of how annotations are stored inside Embedded Wizard project files. The knowledge about the syntax can be helpful when you plan to process the project contents by third party tools. In particular, the general purpose Export and Import functionality introduced in version 14 requires a good understanding of how project members are represented in Chora syntax to correctly interpret the exported members and synthesize the Chora code for members to import. Please note, Embedded Wizard project files (and thus Chora code) are encoded as text in UTF-8 format.
In Chora syntax, annotation legend definition is always introduced with the keywords note legend, followed by the name of the annotation member and a list of initialization values for member's own attributes. The attributes are enclosed between a pair of curly braces {..}, whereby each attribute starts with the keyword attr followed by the name of the affected attribute, an assignment operator =, the assigned value and ; semicolon sign. Wherever necessary, the tokens are separated by whitespace signs. In case of the annotation legend member, only the attribute Bounds is supported.
The definition of an annotation legend can be initiated by a comment block providing the real content of the annotation legend, means the text to display in the annotation. The content of this comment corresponds to the value of the member's attribute Text. The following example demonstrates the described syntax:
// This comment text appears as the content of the annotation. note legend Hints { attr Bounds = <10,10,500,100>; }
Each Chora file (or text exchanged with an external Export and/or Import tool) can be (or even should be) prefixed with $version directive. This directive determines the version number of the included Chora code. For details concerning the syntax of the version please see the chapter $version macro. Furthermore, the code can include a $scope directive followed by a path to a project member acting as the original owner of the corresponding code. That means the members described by the Chora code existed inside the member specified in $scope.