Menu

[r2017]: / trunk / Src / Help / HTML / dlg_editsnippet.htm  Maximize  Restore  History

Download this file

350 lines (349 with data), 12.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--
* $Rev$
* $Date$
*
* ***** BEGIN LICENSE BLOCK *****
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* The Original Code is dlg_editsnippet.htm
*
* The Initial Developer of the Original Code is Peter Johnson
* (http://www.delphidabbler.com/).
*
* Portions created by the Initial Developer are Copyright (C) 2008-2012 Peter
* Johnson. All Rights Reserved.
*
* Contributor(s):
* NONE
*
* ***** END LICENSE BLOCK *****
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text-html; charset=Windows-1252">
<title>
Add / Edit Snippet Dialogue Box
</title>
<link rel="stylesheet" href="../css/codesnip.css" type="text/css">
</head>
<body>
<object
type="application/x-oleobject"
classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e"
>
<param name="ALink Name" value="SnippetsEditorDlg">
</object>
<h1>
<a name="dlg_editsnippet"></a>
<img alt="Menu icon" src="../images/AddSnippet.gif" class="glyph">
Add Snippet Dialogue Box<br>
<img alt="Menu icon" src="../images/EditSnippet.gif" class="glyph">
Edit Snippet Dialogue Box
</h1>
<p>
This dialogue box is displayed when either the <em>Snippets | New
Snippet</em> or <em>Snippets | Edit Snippet</em> menu options are
selected. It is used to enter details of a new user defined code snippet
or to edit the details of an existing user-defined snippet.
</p>
<p>
If a new snippet is being added all controls are blank or set to default
values. When an existing snippet is being edited the controls are
populated with the snippet's existing properties.
</p>
<h2>
Editing the snippet
</h2>
<p>
The dialogue has multiple tabs. All but the <em>Code</em> tab are optional
&ndash; others can be used to provide additional information about the
snippet. However, if you plan to test compile the snippet you must ensure
that the snippet's dependencies and units are properly set up on the
<em>References</em> tab.
</p>
<h3>
Code Tab
</h3>
<p>
This tab gathers all the information needed to define a snippet. All the
fields are required. They are:
</p>
<ul>
<li>
<div>
<em>Name</em>
</div>
<div>
Enter a name for the snippet in the edit box. The name must be a valid
Unicode Pascal identifier. It must also be unique within the user
database, it may duplicate names in the main database.
</div>
<div>
It is customary to name functions or procedures using the routine's
name. Overloaded routines are often named by suffixing the routine
name with '_A', '_B', '_C' and so on.
</div>
</li>
<li>
<div>
<em>Description</em>
</div>
<div>
Enter a description of the code snippet in the
<a href="markup_editor.htm">markup editor</a>. You can use more than
one paragraph of text. You have the choice of styling the text and
using hyperlinks.
</div>
<div>
The description field should not contain &quot;}&quot; characters
since the field's text is used in comments in exported Pascal code and
the &quot;}&quot; character will terminate the comment early.
</div>
<div>
The description can be previewed using the <em>Preview</em> button.
Clicking this button also validates markup if you have used it.
</div>
</li>
<li>
<div>
<em>Kind</em>
</div>
<div>
Select the <a href="snippet_kinds.htm">kind of snippet</a> from the
drop down list.
</div>
</li>
<li>
<div>
<em>Category</em>
</div>
<div>
Select the category to which the snippet belongs from the drop down
list.
</div>
</li>
<li>
<div>
<em>Source code</em>
</div>
<div>
Enter the snippet's source code in this text box. The format of the
source code is important unless you are using the freeform snippet
kind.
</div>
</li>
</ul>
<h3>
References Tab
</h3>
<p>
Use this tab to specify the snippets and units that are associated with
the snippet being edited. If it is intended to test compile the snippet
then the <em>Dependencies</em> and <em>Units</em> list boxes must be
completed if the snippet depends on a Delphi unit or if it uses another
snippet from the database.
</p>
<p>
The available controls are:
</p>
<ul>
<li>
<div>
<em>Cross-references</em> list box
</div>
<div>
Use this list box to specify any other snippets to be cross-referenced
from this snippet. Check the boxes next to desired snippets. Cross
references are for information only. All snippets are listed, except
for the one being edited.
</div>
<div>
User defined snippets are displayed in blue.
</div>
</li>
<li>
<div>
<em>Dependencies</em> list box
</div>
<div>
Specify any other snippets that this snippet depends upon by checking
the boxes next to the desired snippets in this list box. If this
snippet is to be test compiled then any other snippets it requires
must be specified here or the test compile will fail. The exception is
that <a href="snippet_unit.htm">unit snippets</a> never have any
dependencies.
</div>
<div>
The available entries in this list box will vary according to the
<a href="snippet_kinds.htm">snippet kind</a> and the kind of snippets
it can depend on. For example, <a href="snippet_constant.htm">constant
snippets</a> can't depend on <a href="snippet_routine.htm">routine</a>
snippets and <a href="snippet_unit.htm">unit snippets</a> can't depend
on anything, so the list is empty.
<a href="snippet_freeform.htm">Freeform</a> snippets are never
included.
</div>
<div>
User defined snippets are displayed in blue.
</div>
</li>
<li>
<div>
<em>View Dependencies</em> button
</div>
<div>
Click this button to see all dependencies for the snippet being edited
in the <a href="dlg_dependencies.htm">Dependencies dialogue box</a>.
All entries checked in the <em>Dependencies</em> list box are
included, along with all their dependencies, and so on. You must not
create a circular dependency; the <em>Dependencies</em> dialogue box
will help you detect them.
</div>
</li>
<li>
<div>
<em>Units</em> list box
</div>
<div>
Select any units that this snippet requires in order to compile using
this list box. Required units must be specified if test compilation is
to be attempted. A selection of common units is provided, along with
any units already associated with the snippet. More units can be added
to the list &ndash; see below.
</div>
<div>
Units are &quot;used&quot; in the order they appear in the list. If
this order causes namespace clashes you should prefix ambiguous
identifiers in the source code with the unit name, e.g.
<code>Graphics.TBitmap</code>.
</div>
<div>
<a href="snippet_unit.htm">Unit snippets</a> must declare their used
units in the unit source code, so this list box is disabled when the
snippet kind is <em>unit</em>.
</div>
</li>
<li>
<div>
<em>Add Unit</em> edit box and button
</div>
<div>
If additional units are required in the <em>Units</em> check list box
type the name of the unit in the edit box and click the <em>Add
Unit</em> button. The unit will be added to the <em>Units</em> check
list box and its check box will be checked.
</div>
<div>
This button is disabled for <a href="snippet_unit.htm">unit
snippets</a>.
</div>
</li>
</ul>
<h3>
Extra Information Tab
</h3>
<p>
This tab is used to provide additional descriptive information about the
snippet. Use it for information that supplements the snippet's
description or for crediting authors etc.
</p>
<p>
Enter the required information in the <em>Extra information</em>
<a href="markup_editor.htm">markup editor</a>. You can enter either plain
text of formatted text and hyperlinks using the custom
<a href="reml.htm">REML</a> markup language.
</p>
<p>
The information can be previewed using the <em>Preview</em> button.
Clicking this button also validates markup if you have used it.
</p>
<h3>
Compile Results Tab
</h3>
<p>
Use this tab to specify any known compiler results for the snippet. You
can specify the required compiler in several ways:
</p>
<ul>
<li>
Manually, one compiler at a time using the <em>Set a compile
results</em> list box. Click the drop down button next to the required
compiler then choose the required compile result from the drop down
menu, i.e. one of <em>Success</em>, <em>Warning</em>, <em>Error</em> and
<em>Unknown</em>. To use the keyboard to modify compile results proceed
as follows:
<ol>
<li>
Move the keyboard focus to the list box using the
<span class="smallcaps">Tab</span> key.
</li>
<li>
Select the required compiler using the
<span class="smallcaps">Up</span> and
<span class="smallcaps">Down</span> keys.
</li>
<li>
Press <span class="smallcaps">Space</span> to drop down the menu.
</li>
<li>
Select the required result with the
<span class="smallcaps">Up</span> and
<span class="smallcaps">Down</span> keys.
</li>
<li>
Press <span class="smallcaps">Enter</span> to select the compile
result or <span class="smallcaps">Cancel</span> to abort.
</li>
</ol>
</li>
<li>
Click the <em>Set All To Success</em> button to set every compiler's
result to &quot;success&quot; (green LED).
</li>
<li>
Click the <em>Set All To Query</em> button to set every compiler's
result &quot;query&quot; (grey LED).
</li>
<li>
<div>
Use the <em>Test Compile</em> button to compile the snippet and set
the compile results accordingly. This button is disabled if no
compilers are configured or if the snippet is
<a href="snippet_freeform.htm">freeform</a>.
</div>
<div>
If one or more compilers report warnings or errors, a link appears
below the <em>Test Compile</em> button that can be clicked to display
details of the warnings or errors.
</div>
<div>
You can display the unit used to perform the test compilation by
clicking the <em>View Test Unit</em> button. This can be useful when
tracking down errors.
</div>
</li>
</ul>
<h2>
Commiting the edit
</h2>
<p>
Clicking <em>OK</em> causes the edited snippet to be validated. If an
error is found the control where the error is located is selected and an
error message is displayed. If the snippet is valid the dialogue box
closes and the user database is updated.
</p>
<p>
Click <em>Cancel</em> to abort the edit.
</p>
</body>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.