{"id":391,"date":"2014-09-27T15:20:00","date_gmt":"2014-09-27T20:20:00","guid":{"rendered":"http:\/\/www.amibroker.com\/kb\/?p=391"},"modified":"2014-12-04T04:37:18","modified_gmt":"2014-12-04T09:37:18","slug":"how-to-create-your-own-code-snippet","status":"publish","type":"post","link":"https:\/\/www.amibroker.com\/wordpress\/kb\/2014\/09\/27\/how-to-create-your-own-code-snippet\/","title":{"rendered":"How to create your own code snippet"},"content":{"rendered":"

AmiBroker 5.84 (released today) offers users an easy way to create their own code snippets. Code snippet is a small piece of re-usable AFL code. AmiBroker comes with lots of pre-defined snippets. You can learn more about built-in snippets here<\/a>.<\/p>

But now you can add your own! And it is fairly easy using new Code Snippet<\/strong> window. Code Snippets<\/strong> window is available in new AFL editor (in floating frame mode). It can be shown\/hidden using Window<\/strong> menu. <\/p>

To create your own snippet, do the following:<\/p>

  1. type the code you want
  2. select (mark) the code you want to place in a snippet
  3. press Save selection as snippet button in the Code Snippets<\/strong> window<\/ol>

    \"Code<\/p>

    If you do the steps above the following dialog will appear:<\/p>

    \"Code<\/p>

    Now you need to enter the Name<\/strong> of the snippet, the Description<\/strong> and Category<\/strong>. Category<\/strong> can be selected from already existing items (using drop down box), or new category name can be typed in the category field. Key trigger<\/strong> field is optional and contains snippet auto-complete trigger (to be implemented later). Once you enter all fields and press OK, your new snippet will appear in the list.<\/p>

    \"Code<\/p>

    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.<\/p>

    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 overwrite existing user-defined snippet, simply follow the steps above and give existing<\/strong> name. AmiBroker will ask then if you want to overwrite existing snippet. To delete a snippet, select the snippet you want to delete from the list and press Delete<\/strong> (X) button in the Code Snippet<\/strong> window.<\/p>","protected":false},"excerpt":{"rendered":"

    AmiBroker 5.84 (released today) offers users an easy way to create their own code snippets. Code snippet is a small piece of re-usable AFL code. AmiBroker comes with lots of pre-defined snippets. You can learn more about built-in snippets here.But now you can add your own! And it is fairly easy using new Code Snippet […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[35],"tags":[53,24],"_links":{"self":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/391"}],"collection":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/comments?post=391"}],"version-history":[{"count":1,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/391\/revisions"}],"predecessor-version":[{"id":807,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/391\/revisions\/807"}],"wp:attachment":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/media?parent=391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/categories?post=391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/tags?post=391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}