1cdk_entry(3) Library Functions Manual cdk_entry(3)
2
3
4
6 cdk_entry - curses text-entry widget.
7
9 cc [ flag ... ] file ... -lcdk [ library ... ]
10
11 #include <cdk.h>
12
13 char *activateCDKEntry (
14 CDKENTRY *entry,
15 chtype *actions);
16
17 void cleanCDKEntry (
18 CDKENTRY *entry);
19
20 void destroyCDKEntry (
21 CDKENTRY *entry);
22
23 void drawCDKEntry (
24 CDKENTRY *entry,
25 boolean box);
26
27 void eraseCDKEntry (
28 CDKENTRY *entry);
29
30 boolean getCDKEntryBox (
31 CDKENTRY *entry);
32
33 chtype getCDKEntryFillerChar (
34 CDKENTRY *entry);
35
36 chtype getCDKEntryHiddenChar (
37 CDKENTRY *entry);
38
39 int getCDKEntryMax (
40 CDKENTRY *entry);
41
42 int getCDKEntryMin (
43 CDKENTRY *entry);
44
45 char *getCDKEntryValue (
46 CDKENTRY *entry);
47
48 int injectCDKEntry (
49 CDKENTRY *entry,
50 chtype input);
51
52 void moveCDKEntry (
53 CDKENTRY *entry,
54 int xpos,
55 int ypos,
56 boolean relative,
57 boolean refresh);
58
59 CDKENTRY *newCDKEntry (
60 CDKSCREEN *cdkscreen,
61 int xpos,
62 int ypos,
63 const char *title,
64 const char *label,
65 chtype fieldAttribute,
66 chtype fillerCharacter,
67 EDisplayType displayType,
68 int fieldWidth,
69 int minimumLength,
70 int maximumLength,
71 boolean box,
72 boolean shadow);
73
74 void positionCDKEntry (
75 CDKENTRY *entry);
76
77 void setCDKEntry (
78 CDKENTRY *entry,
79 const char *value,
80 int minimumLength,
81 int maximumLength,
82 boolean box);
83
84 void setCDKEntryBackgroundAttrib (
85 CDKENTRY *entry,
86 chtype attribute);
87
88 void setCDKEntryBackgroundColor (
89 CDKENTRY *entry,
90 const char * color);
91
92 void setCDKEntryBox (
93 CDKENTRY *entry,
94 boolean box);
95
96 void setCDKEntryBoxAttribute (
97 CDKENTRY *entry,
98 chtype character);
99
100 void setCDKEntryCB (
101 CDKENTRY *entry,
102 ENTRYCB callBackFunction);
103
104 void setCDKEntryFillerChar (
105 CDKENTRY *entry,
106 chtype character);
107
108 void setCDKEntryHiddenChar (
109 CDKENTRY *entry,
110 chtype character);
111
112 void setCDKEntryHighlight (
113 CDKENTRY *entry,
114 chtype highlight,
115 boolean cursor);
116
117 void setCDKEntryHorizontalChar (
118 CDKENTRY *entry,
119 chtype character);
120
121 void setCDKEntryLLChar (
122 CDKENTRY *entry,
123 chtype character);
124
125 void setCDKEntryLRChar (
126 CDKENTRY *entry,
127 chtype character);
128
129 void setCDKEntryMax (
130 CDKENTRY *entry,
131 int maximum);
132
133 void setCDKEntryMin (
134 CDKENTRY *entry,
135 int minimum);
136
137 void setCDKEntryPostProcess (
138 CDKENTRY *entry,
139 PROCESSFN callback,
140 void * data);
141
142 void setCDKEntryPreProcess (
143 CDKENTRY *entry,
144 PROCESSFN callback,
145 void * data);
146
147 void setCDKEntryULChar (
148 CDKENTRY *entry,
149 chtype character);
150
151 void setCDKEntryURChar (
152 CDKENTRY *entry,
153 chtype character);
154
155 void setCDKEntryValue (
156 CDKENTRY *entry,
157 const char *value);
158
159 void setCDKEntryVerticalChar (
160 CDKENTRY *entry,
161 chtype character);
162
164 The Cdk entry widget creates a text-entry box with a label and an entry
165 field. The following functions create or manipulate the Cdk entry box
166 widget.
167
169 activateCDKEntry
170 activates the entry widget and lets the user interact with the
171 widget. The parameter entry is a pointer to a non-NULL entry wid‐
172 get. If the actions parameter is passed with a non-NULL value,
173 the characters in the array will be injected into the widget. To
174 activate the widget interactively pass in a NULL pointer for
175 actions. If the character entered into this widget is RETURN or
176 TAB then this function will return a char * representing the
177 information typed into the widget and the widget data exitType
178 will be set to vNORMAL. If the character entered was ESCAPE then
179 the function will return NULL pointer and the widget data exitType
180 is set to vESCAPE_HIT.
181
182 cleanCDKEntry
183 clears the information from the field.
184
185 destroyCDKEntry
186 removes the widget from the screen and frees memory the object
187 used.
188
189 drawCDKEntry
190 draws the entry widget on the screen. If the box parameter is
191 true, the widget is drawn with a box.
192
193 eraseCDKEntry
194 removes the widget from the screen. This does NOT destroy the
195 widget.
196
197 getCDKEntryBox
198 returns true if the widget will be drawn with a box around it.
199
200 getCDKEntryFillerChar
201 returns the character being used to draw unused space in the wid‐
202 get.
203
204 getCDKEntryHiddenChar
205 returns the character being used to draw the hidden character
206 type.
207
208 getCDKEntryMax
209 returns the maximum length of a string the widget will allow.
210
211 getCDKEntryMin
212 returns the minimum length of a string the widget will allow.
213
214 getCDKEntryValue
215 returns the current value of the widget.
216
217 injectCDKEntry
218 injects a single character into the widget. The parameter entry
219 is a pointer to a non-NULL entry widget. The parameter character
220 is the character to inject into the widget. The return value and
221 side-effect (setting the widget data exitType) depend upon the
222 injected character:
223
224 RETURN or TAB
225 the function returns a char * representing the information
226 typed into the widget. The widget data exitType is set to
227 vNORMAL.
228
229 ESCAPE the function returns a NULL pointer. The widget data exit‐
230 Type is set to vESCAPE_HIT.
231
232 Otherwise
233 unless modified by preprocessing, postprocessing or key
234 bindings, the function returns a NULL pointer. The widget
235 data exitType is set to vEARLY_EXIT.
236
237 moveCDKEntry
238 moves the given widget to the given position. The parameters xpos
239 and ypos are the new position of the widget. The parameter xpos
240 may be an integer or one of the pre-defined values TOP, BOTTOM,
241 and CENTER. The parameter ypos may be an integer or one of the
242 pre-defined values LEFT, RIGHT, and CENTER. The parameter rela‐
243 tive states whether the xpos/ypos pair is a relative move or an
244 absolute move. For example, if xpos = 1 and ypos = 2 and relative
245 = TRUE, then the widget would move one row down and two columns
246 right. If the value of relative was FALSE then the widget would
247 move to the position (1,2). Do not use the values TOP, BOTTOM,
248 LEFT, RIGHT, or CENTER when relative = TRUE. (weird things may
249 happen). The final parameter refresh is a boolean value which
250 states whether the widget will get refreshed after the move.
251
252 newCDKEntry
253 creates a pointer to an entry widget. Parameters:
254
255 The screen parameter
256 is the screen you wish this widget to be placed in.
257
258 xpos controls the placement of the object along the horizontal
259 axis. It may be an integer or one of the pre-defined values
260 LEFT, RIGHT, and CENTER.
261
262 ypos controls the placement of the object along the vertical axis.
263 It may be an integer or one of the pre-defined values TOP,
264 BOTTOM, and CENTER.
265
266 title
267 is the string which will be displayed at the top of the wid‐
268 get. The title can be more than one line; just provide a
269 carriage return character at the line break.
270
271 label
272 is the string which will be displayed in the label of the
273 entry field.
274
275 fieldAttribute
276 is the attribute of the characters which are typed in.
277
278 filler
279 is the character which is to be displayed in an empty space
280 in the entry field.
281
282 displayType
283 tells how the entry field will behave when a character is
284 entered into the field. See cdk_display (3) for valid values
285 for this field.
286
287 fieldWidth
288 denotes the width of the field. If a value of zero is pro‐
289 vided, the field will be made as wide as possible on the
290 screen. If a negative value is given, then the field width
291 will be the maximum width minus the value provided.
292
293 minimumLength
294 controls the number of characters which must be entered
295 before the user can exit the entry field.
296
297 maximumLength
298 sets the maximum number of characters that can be entered.
299
300 box is true if the widget should be drawn with a box around it.
301
302 shadow
303 turns the shadow on around this widget.
304
305 If the widget could not be created then a NULL pointer is
306 returned.
307
308 positionCDKEntry
309 allows the user to move the widget around the screen via the cur‐
310 sor/keypad keys. The following key bindings can be used to move
311 the widget around the screen. See cdk_position (3) for key bind‐
312 ings.
313
314 setCDKEntry
315 lets the programmer modify certain elements of an existing entry
316 widget. The value parameter sets the value of the contents of the
317 entry field. The other parameter names correspond to the same
318 parameter names listed in the newCDKEntry function.
319
320 setCDKEntryBackgroundAttrib
321 sets the background attribute of the widget. The parameter
322 attribute is a curses attribute, e.g., A_BOLD.
323
324 setCDKEntryBackgroundColor
325 sets the background color of the widget. The parameter color is
326 in the format of the Cdk format strings. See cdk_display (3).
327
328 setCDKEntryBox
329 sets whether the widget will be drawn with a box around it.
330
331 setCDKEntryBoxAttribute
332 function sets the attribute of the box.
333
334 setCDKEntryCB
335 allows the programmer to set a different widget input handler.
336 The parameter callbackFunction is of type ENTRYCB. The default
337 function is CDKEntryCallBack.
338
339 setCDKEntryFillerChar
340 sets the character to use when drawing unused space in the field.
341
342 setCDKEntryHiddenChar
343 sets the character to use when using a hidden character type.
344
345 setCDKEntryHighlight
346 sets the attribute of the entry field.
347
348 setCDKEntryHorizontalChar
349 sets the horizontal drawing character for the box to the given
350 character.
351
352 setCDKEntryLLChar
353 sets the lower left hand corner of the widget's box to the given
354 character.
355
356 setCDKEntryLRChar
357 sets the lower right hand corner of the widget's box to the given
358 character.
359
360 setCDKEntryMax
361 sets the maximum length of the string that the widget will allow.
362
363 setCDKEntryMin
364 sets the minimum length of the string that the widget will allow.
365
366 setCDKEntryPostProcess
367 allows the user to have the widget call a function after the key
368 has been applied to the widget. The parameter function is the
369 callback function. The parameter data points to data passed to
370 the callback function. To learn more about post-processing see
371 cdk_process [4m(3).
372
373 setCDKEntryPreProcess
374 allows the user to have the widget call a function after a key is
375 hit and before the key is applied to the widget. The parameter
376 function is the callback function. The parameter data points to
377 data passed to the callback function. To learn more about pre-
378 processing see cdk_process [4m(3).
379
380 setCDKEntryULChar
381 sets the upper left hand corner of the widget's box to the given
382 character.
383
384 setCDKEntryURChar
385 sets the upper right hand corner of the widget's box to the given
386 character.
387
388 setCDKEntryValue
389 sets the current value of the widget.
390
391 setCDKEntryVerticalChar
392 sets the vertical drawing character for the box to the given char‐
393 acter.
394
396 When the widget is activated there are several default key bindings
397 which will help the user enter or manipulate the information quickly.
398 The following table outlines the keys and their actions for this wid‐
399 get.
400
401 Key Action
402 ──────────────────────────────────────────────────────────────────────
403 Left Arrow Moves the cursor to the left.
404 CTRL-B Moves the cursor to the left.
405 Right Arrow Moves the cursor to the right.
406
407 CTRL-F Moves the cursor to the right.
408 Delete Deletes the character at the cursor.
409 Backspace Deletes the character before cursor, moves cursor left.
410 CTRL-V Pastes whatever is in the paste buffer, into the wid‐
411 get.
412 CTRL-X Cuts the contents from the widget and saves a copy in
413 the paste buffer.
414 CTRL-Y Copies the contents of the widget into the paste buf‐
415 fer.
416 CTRL-U Erases the contents of the widget.
417 CTRL-A Moves the cursor to the beginning of the entry field.
418 CTRL-E Moves the cursor to the end of the entry field.
419 CTRL-T Transposes the character under the cursor with the
420 character to the right.
421 Return Exits the widget and returns a char * representing the
422 information which was typed into the field. It also
423 sets the widget data exitType to vNORMAL.
424 Tab Exits the widget and returns a char * representing the
425 information which was typed into the field. It also
426 sets the widget data exitType to vNORMAL.
427 Escape Exits the widget and returns a NULL pointer. It also
428 sets the widget data exitType to vESCAPE_HIT.
429 Ctrl-L Refreshes the screen.
430 ──────────────────────────────────────────────────────────────────────
431
433 cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3),
434 cdk_process(3), cdk_screen(3)
435
436
437
438 cdk_entry(3)