Hello Paul -
Does the code below do what you want, or am I oversimplifying the matter? This
code monitors a simple calculation and outputs a number periodically (every
million iterations).
//--------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Output.H>
Fl_Output *F01;
//---+----3----+----2----+----1----+---<>---+----1----+----2----+----3
//------------------------------ Computations ----------------------
void Computations (void)
{
static int i = 0, refresh;
static char buf1[20] = "123456789";
if ((++i % 1000000) == 0) refresh = 1;
else refresh = 0;
if (refresh) {
printf (" i = %9d\n", i);
sprintf (buf1, "%9d" , i);
F01->value (buf1);
}
}
//---+----3----+----2----+----1----+---<>---+----1----+----2----+----3
//------------------------------- Start_Stop -----------------------
void Start_Stop (Fl_Object *o, void *)
{
static int go = 0;
go = !go;
if (go) Fl::set_idle (Computations);
else Fl::set_idle (NULL);
printf (" go = %d\n", go);
}
//---+----3----+----2----+----1----+---<>---+----1----+----2----+----3
//------------------------------- Define_GUI -----------------------
void Define_GUI (void)
{
static int go = 0;
Fl_Window *Wnd_A = new Fl_Window (200,200, 500,300, "Process");
Fl_Button *b1 = new Fl_Button (300, 20, 100, 30, "Start");
b1->callback (Start_Stop);
F01 = new Fl_Output (100, 20, 100, 30, "F01");
F01->value (" xyz ");
Wnd_A->end ();
Wnd_A->show ();
}
//---+----3----+----2----+----1----+---<>---+----1----+----2----+----3
//---------------------------------- main --------------------------
void main (void)
{
printf ("\n Process Reporting\n\n");
Define_GUI ();
Fl::run();
}
//--------------------------------------------------------------------
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk