Tecnicamente la libreria CDK non fornisce una GUI (Graphic User Interface) bensi' una TUI (Text User Interface)
L'esempio riportato e' preso integralmente dai file di esempio; a differenza dei casi precedenti questo tool mette insieme sia lo slider che la progress bar quindi e' tutto integrato in un solo comando
Per modificare il valore dello slider si usano le frecce cursore alto/basso
----------------------------------------------------------
#include <cdk/cdk.h>
int main (int argc, char **argv)
{
/* *INDENT-EQLS* */
CDKSCREEN *cdkscreen = 0;
CDKSLIDER *widget = 0;
WINDOW *cursesWin = 0;
const char *title = "<C></U>ProgressBar";
const char *label = "</B>Valore:";
char temp[256];
const char *mesg[5];
int selection;
CDK_PARAMS params;
int high;
int inc;
int low;
CDKparseParams (argc, argv, ¶ms, "h:i:l:w:" CDK_MIN_PARAMS);
high = CDKparamNumber2 (¶ms, 'h', 100);
inc = CDKparamNumber2 (¶ms, 'i', 1);
low = CDKparamNumber2 (¶ms, 'l', 1);
/* Set up CDK. */
cursesWin = initscr ();
cdkscreen = initCDKScreen (cursesWin);
/* Start CDK Colors. */
initCDKColor ();
/* Create the widget. */
widget = newCDKSlider (cdkscreen,
CDKparamValue (¶ms, 'X', CENTER),
CDKparamValue (¶ms, 'Y', CENTER),
title, label,
A_REVERSE | COLOR_PAIR (29) | ' ',
CDKparamNumber2 (¶ms, 'w', 50),
low, low, high,
inc, (inc * 2),
CDKparamValue (¶ms, 'N', TRUE),
CDKparamValue (¶ms, 'S', FALSE));
/* Is the widget null? */
if (widget == 0)
{
/* Exit CDK. */
destroyCDKScreen (cdkscreen);
endCDK ();
printf ("Cannot make the widget. Is the window too small?\n");
return 1;
}
/* Activate the widget. */
selection = activateCDKSlider (widget, 0);
/* Check the exit value of the widget. */
if (widget->exitType == vESCAPE_HIT)
{
mesg[0] = "<C>Nessun valore selezionato";
mesg[1] = "",
mesg[2] = "<C>Un tasto per continuare.";
popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3);
}
else if (widget->exitType == vNORMAL)
{
sprintf (temp, "<C>E'stato selezionato %d", selection);
mesg[0] = temp;
mesg[1] = "",
mesg[2] = "<C>Un tasto per continuare.";
popupLabel (cdkscreen, (CDK_CSTRING2) mesg, 3);
}
/* Clean up. */
destroyCDKSlider (widget);
destroyCDKScreen (cdkscreen);
endCDK ();
return 0;
}
Iscriviti a:
Commenti sul post (Atom)
Perche' investire su Unix
Un libro trovato nel libero scambio alla Coop su cio' che poteva essere e non e' stato...interessante la storia su Unix del primo c...
-
Per lo shield WiFly e' stata effettuata la patch descritta qui Per la connessione del lettore Rfid si usano i seguenti pin VCC ...
-
Questo post e' a seguito di quanto gia' visto nella precedente prova Lo scopo e' sempre il solito: creare un sistema che permet...
-
In questo post viene indicato come creare uno scatterplot dinamico basato da dati ripresi da un file csv (nel dettaglio il file csv e' c...
Nessun commento:
Posta un commento