4
char *XCursesProgramName="preprocess_ex";
7
int entryPreProcessCB (EObjectType cdkType, void *object, void *clientData, chtype input);
10
* This demonstrates the Cdk entry field widget.
14
/* Declare local variables. */
15
CDKSCREEN *cdkscreen = 0;
17
WINDOW *cursesWin = 0;
18
char *title = "<C>Type in anything you want\n<C>but the dreaded letter </B>G<!B>!";
19
char *info, *mesg[10], temp[256];
22
cursesWin = initscr();
23
cdkscreen = initCDKScreen (cursesWin);
25
/* Start CDK colors. */
28
/* Create the entry field widget. */
29
widget = newCDKEntry (cdkscreen, CENTER, CENTER,
30
title, 0, A_NORMAL, '.', vMIXED,
31
40, 0, 256, TRUE, TRUE);
33
/* Is the widget null? */
37
destroyCDKScreen (cdkscreen);
40
/* Print out a little message. */
41
printf ("Oops. Can't seem to create the entry box. Is the window too small?\n");
45
setCDKEntryPreProcess (widget, entryPreProcessCB, 0);
47
/* Activate the entry field. */
48
info = activateCDKEntry (widget, 0);
50
/* Tell them what they typed. */
51
if (widget->exitType == vESCAPE_HIT)
53
mesg[0] = "<C>You hit escape. No information passed back.";
55
mesg[2] = "<C>Press any key to continue.";
56
popupLabel (cdkscreen, mesg, 3);
58
else if (widget->exitType == vNORMAL)
60
mesg[0] = "<C>You typed in the following";
61
sprintf (temp, "<C>(%s)", info);
62
mesg[1] = copyChar (temp);
64
mesg[3] = "<C>Press any key to continue.";
65
popupLabel (cdkscreen, mesg, 4);
69
/* Clean up and exit. */
70
destroyCDKEntry (widget);
71
destroyCDKScreen (cdkscreen);
77
int entryPreProcessCB (EObjectType cdkType GCC_UNUSED, void *object, void *clientData GCC_UNUSED, chtype input)
79
CDKENTRY *entry = (CDKENTRY *)object;
80
CDKDIALOG *widget = 0;
81
char *buttons[] = {"OK"};
86
/* Check the input. */
87
if ((input == 'g') || (input == 'G'))
89
mesg[lines++] = "<C><#HL(30)>";
90
mesg[lines++] = "<C>I told you </B>NOT<!B> to type G";
91
mesg[lines++] = "<C><#HL(30)>";
93
widget = newCDKDialog (ScreenOf(entry), CENTER, CENTER,
94
mesg, lines, buttons, buttonCount,
95
A_REVERSE, FALSE, FALSE, FALSE);
96
activateCDKDialog (widget, 0);
97
destroyCDKDialog (widget);
98
drawCDKEntry (entry, ObjOf(entry)->box);