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;
}
Visualizzazione post con etichetta cd. Mostra tutti i post
Visualizzazione post con etichetta cd. Mostra tutti i post
mercoledì 5 settembre 2012
Iscriviti a:
Commenti (Atom)
Analisi MNF su spettri di riflettanza di plastica
Devo cerca di lavorare su spettri di riflettanza di plastica e la prima domanda e': quale sono le bande significative? Sono partito dal ...
-
Aggiornamento questo e' la risposta degli sviluppatori First of all, almost all operating systems on both mobile and laptop/desktop n...
-
La scheda ESP32-2432S028R monta un Esp Dev Module con uno schermo TFT a driver ILI9341 di 320x240 pixels 16 bit colore.Il sito di riferiment...
-
Questo post e' a seguito di quanto gia' visto nella precedente prova Lo scopo e' sempre il solito: creare un sistema che permet...
