4
char *XCursesProgramName="scale_ex";
8
* This program demonstrates the Cdk scale widget.
10
int main (int argc, char **argv)
12
/* Declare variables. */
13
CDKSCREEN *cdkscreen = 0;
15
WINDOW *cursesWin = 0;
16
char *title = "<C>Select a value\n<R>scale\n<L>scale";
17
char *label = "</5>Current value";
21
char temp[256], *mesg[5];
24
/* Parse up the command line.*/
27
ret = getopt (argc, argv, "l:h:i:");
29
/* Are there any more command line options to parse. */
52
cursesWin = initscr();
53
cdkscreen = initCDKScreen (cursesWin);
55
/* Start CDK Colors. */
58
/* Create the scale. */
59
scale = newCDKScale (cdkscreen, CENTER, CENTER,
60
title, label, A_NORMAL,
62
inc, (inc*2), TRUE, TRUE);
64
/* Is the scale null? */
68
destroyCDKScreen (cdkscreen);
71
/* Print out a message. */
72
printf ("Oops. Can't make the scale widget. Is the window too small?\n");
76
/* Activate the scale. */
77
selection = activateCDKScale (scale, 0);
79
/* Check the exit value of the scale widget. */
80
if (scale->exitType == vESCAPE_HIT)
82
mesg[0] = "<C>You hit escape. No value selected.";
84
mesg[2] = "<C>Press any key to continue.";
85
popupLabel (cdkscreen, mesg, 3);
87
else if (scale->exitType == vNORMAL)
89
sprintf (temp, "<C>You selected %d", selection);
90
mesg[0] = copyChar (temp);
92
mesg[2] = "<C>Press any key to continue.";
93
popupLabel (cdkscreen, mesg, 3);
98
destroyCDKScale (scale);
99
destroyCDKScreen (cdkscreen);