Code snippets are small re-usable pieces of AFL code, detailed information on usage of Code Snippets can be found in this tutorial.
Code Snippets window is available in new AFL editor. It can be shown/hidden using Window menu.
To insert an existing snippet, drag-drop the snippet from the Code Snippet list into AFL Editor, or double click on the snippet.
CREATING YOUR OWN SNIPPET
To create your own snippet, do the following:
If you do the steps above the following dialog will appear:
Now you need to enter the Name of the snippet, the Description and Category. Category can be selected from already existing items (using drop down box), or new category name can be typed in the category field. Key trigger field is optional and contains snippet auto-complete trigger (described above). The Formula field is the snippet code itself. Once you enter all fields and press OK, your new snippet will appear in the list.
From then on you can use your own snippet the same way as existing snippets. Perhaps most convenient method is using drag-drop from the list to AFL editor.
As you may have noticed user-defined snippets are marked with red color box in the Code Snippets list. Only user-defined snippets can be overwritten and/or deleted.
To edit existing user-defined snippet, you can either follow the steps above and give existing name. AmiBroker will ask then if you want to overwrite existing snippet, or you can simply click on Properties button and edit the snippet directly, without re-inserting it.
To delete a snippet, select the snippet you want to delete from the list and press Delete (X) button in the Code Snippet window.