File: get_string.c

package info (click to toggle)
libcdk5 5.0.20260119-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,552 kB
  • sloc: ansic: 32,727; sh: 5,317; makefile: 1,205; awk: 55; sed: 49; cpp: 41
file content (43 lines) | stat: -rw-r--r-- 916 bytes parent folder | download | duplicates (3)
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
#include <cdk_int.h>

/*
 * $Author: tom $
 * $Date: 2025/01/09 00:20:21 $
 * $Revision: 1.4 $
 */

/*
 * This gets information from a user.
 */
char *getString (CDKSCREEN *screen,
		 const char *title,
		 const char *label,
		 const char *initValue)
{
   /* *INDENT-EQLS* */
   CDKENTRY *widget     = NULL;
   char *value          = NULL;

   /* Create the widget. */
   widget = newCDKEntry (screen, CENTER, CENTER, title, label,
			 A_NORMAL, '.', vMIXED, 40, 0,
			 5000, TRUE, FALSE);

   /* Set the default value. */
   setCDKEntryValue (widget, initValue);

   /* Get the string. */
   (void)activateCDKEntry (widget, NULL);

   /* Make sure they exited normally. */
   if (widget->exitType != vNORMAL)
   {
      destroyCDKEntry (widget);
      return NULL;
   }

   /* Return a copy of the string typed in. */
   value = copyChar (getCDKEntryValue (widget));
   destroyCDKEntry (widget);
   return value;
}