5
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
2 |
<html lang="en">
|
|
3 |
|
|
4 |
<head>
|
|
5 |
<meta http-equiv="Content-Language" content="en-us">
|
|
6 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
7 |
<title>Creating and editing templates</title>
|
|
8 |
<link rel="stylesheet" type="text/css" href="../help.css">
|
|
9 |
</head>
|
|
10 |
|
|
11 |
<body>
|
|
12 |
|
|
13 |
<h1>Creating and editing templates</h1>
|
|
14 |
<p>Content Assist uses templates to enable you to quickly make use of commonly used code segments. </p>
|
|
15 |
<p>To create a template:</p>
|
|
16 |
|
|
17 |
<ol>
|
|
18 |
<li>Click <b>Window > Preferences</b>.</li>
|
|
19 |
<li>Expand <b>C/C++</b>, expand <b>Editor</b> and select <b>Templates</b>.</li>
|
|
20 |
<li>Click <b>New</b>.<p><br>
|
|
21 |
<img src="../images/code_templates_new.png" alt="Creating a new Code Template Window"><br></p>
|
|
22 |
<br>
|
|
23 |
</li>
|
|
24 |
<li><p>Do the following: (if required)</p>
|
|
25 |
<ul>
|
|
26 |
<li>In the <b>Name</b> field, type a template name.</li>
|
|
27 |
<li>In the <b>Context</b> drop down list, select the context type for the new template; either <b>C/C++</b> or a <b>Comment</b>.</li>
|
|
28 |
<li>In the <b>Description</b> field, type a description for the new template.</li>
|
|
29 |
<li>In the <b>Pattern</b> field, type the code for this template.</li>
|
|
30 |
<li>Click <b>Insert Variable</b> to add a variable from the list to the code you have entered in the <b>Pattern</b> field.</li>
|
|
31 |
</ul>
|
|
32 |
</li>
|
|
33 |
<li>Click <b>OK</b>.<br>
|
|
34 |
The new template displays in the Templates list. </li>
|
|
35 |
</ol>
|
|
36 |
|
|
37 |
<p>To edit a template:</p>
|
|
38 |
|
|
39 |
<ol>
|
|
40 |
<li>Click <b>Window > Preferences</b>.</li>
|
|
41 |
<li>Expand <b>C/C++</b>, expand <b>Editor</b> and select <b>Templates</b>.</li>
|
|
42 |
<li>Click <b>Edit</b>. The Edit Template dialog opens.<p><br>
|
|
43 |
<img src="../images/codetemplates_example.png" alt="Editing a Code Template"><br></p>
|
|
44 |
<br></li>
|
|
45 |
<li><p>Do the following:</p>
|
|
46 |
<ul>
|
|
47 |
<li>In the <b>Name</b> field, change the template name to create a new
|
|
48 |
template based on the current template. </li>
|
|
49 |
<li>In the <b>Context</b> drop down list, select the context type for the new template; either <b>C/C++</b> or a <b>Comment</b>.</li>
|
|
50 |
<li>In the <b>Description</b> field, change the description of the code
|
|
51 |
template to reflect your changes.</li>
|
|
52 |
<li>In the <b>Pattern</b> field, edit the code.</li>
|
|
53 |
<li>Click <b>Insert Variable</b> to add a variable from the list to the
|
|
54 |
code you edited in the <b>Pattern</b> field.</li>
|
|
55 |
</ul>
|
|
56 |
</li>
|
|
57 |
<li>Click <b>OK</b>.</li>
|
|
58 |
</ol>
|
|
59 |
|
|
60 |
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
|
|
61 |
<br>
|
|
62 |
<a href="../concepts/cdt_c_content_assist.htm">Content Assist</a></p>
|
|
63 |
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
|
|
64 |
<br>
|
|
65 |
<a href="cdt_t_contentassist.htm">Using Content Assist</a><br>
|
|
66 |
<a href="cdt_t_imp_code_temp.htm">Importing and exporting templates</a></p>
|
|
67 |
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21"> <br>
|
|
68 |
<a href="../reference/cdt_u_code_temp.htm">Templates page</a></p>
|
|
69 |
<p>
|
|
70 |
<img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" >
|
|
71 |
|
|
72 |
</body>
|
|
73 |
|
|
74 |
</html> |