CodeSnippets instead of tag dialogs

November 27, 2006

One of the features that you might be missing in WebPad.NET are the tag dialogs, which you find in WebCoder. However, WebPad.NET is a light version, and I think the dialogs were an easy decision to leave out. If you really want them, WebCoder might still be a better choice for you, but I do wish to point out that WebPad.NET comes with a bunch of features to help you write tags faster. The obvious ones are of course AutoProposal and AutoComplete, which can make the process of writing a tag much faster. You could also create a user button, with the most common attributes included. In this blog I will use my own personal favorite approach, which is related to the brand new CodeSnippet functionality in WebPad.NET. If you haven't already done so, you should really go and check out the demo video of CodeSnippets.

Since a user I have been e-mailing with wanted a dialog for image tags in WebPad.NET, I will use the image tag as an example for this post. Please use the following steps to create an image tag CodeSnippet:

  1. Select Functions -> Manage Code Snippets
  2. Select HTML from the language dropdown
  3. Click the Plus button to create a new snippet
  4. Use the following properties: Title = Image tag, Shortcut = img and Code = <img src="$src$" alt="$alt$" />
  5. Press the Ok button. WebPad.NET will ask you to add the declarations. Click Yes.
  6. The Code Snippet Declaration dialog will pop up. You can edit the declarations to give them more saying names, default values and tooltips, but it's not required. Click Ok when you're done.

The Code Snippet has been created, and it's ready to use. The easiest way is to simply enter img in the editor field, and then press Tab. The tag will be inserted, and you are now in CodeSnippet mode. The first declaration will be highlighted, and you can enter a proper value for it. Use Tab to move to the next declaration. Once you're done, the press Enter and the tag will be complete, and the cursor will be positioned after the tag.

As you can hopefully see, CodeSnippets can be really powerful. You can create some for the tags you use the most, but the feature offers even greater potential, especially if you're using more complex languages like PHP. That's all for now, I hope you could use this post :)

Kasper (TSW) @ 8:26 pm in WebPad.NET

Leave a Reply