4
char *XCursesProgramName="selection_ex";
9
/* Declare variables. */
10
CDKSCREEN *cdkscreen = 0;
11
CDKSELECTION *selection = 0;
12
WINDOW *cursesWin = 0;
13
//char *title = "<C></5>Pick one or more accounts.\n<R>selection\n<L>selection";
14
char *title = "<C></5>selection\n<R>selection\n<L>selection";
15
char *choices[] = {" ", "-->"};
16
char *item[400], temp[256], *mesg[200];
21
cursesWin = initscr();
22
cdkscreen = initCDKScreen (cursesWin);
24
/* Set up CDK Colors. */
27
/* Use the account names to create a list. */
29
while ((ent = getpwent ()) != 0)
31
item[count++] = copyChar (ent->pw_name);
35
/* Create the selection list. */
36
selection = newCDKSelection (cdkscreen, CENTER, CENTER, LEFT,
37
10, 13, title, item, count, choices, 2,
38
A_REVERSE, TRUE, TRUE);
40
/* Is the selection list null? */
44
destroyCDKScreen (cdkscreen);
47
/* Print out a message and exit. */
48
printf ("Oops. Can;t seem to create the selection list. Is the window too small?\n");
52
/* Activate the selection list. */
53
activateCDKSelection (selection, 0);
55
/* Check the exit status of the widget. */
56
if (selection->exitType == vESCAPE_HIT)
58
mesg[0] = "<C>You hit escape. No items selected.";
60
mesg[2] = "<C>Press any key to continue.";
61
popupLabel (cdkscreen, mesg, 3);
63
else if (selection->exitType == vNORMAL)
65
mesg[0] = "<C>Here are the accounts you selected.";
67
for (x=0; x < count; x++)
69
if (selection->selections[x] == 1)
71
sprintf (temp, "<C></5>%s", item[x]);
72
mesg[y++] = copyChar (temp);
75
popupLabel (cdkscreen, mesg, y);
85
destroyCDKSelection (selection);
86
destroyCDKScreen (cdkscreen);