> paul wrote:
> > hi can anyone suggest a way to output fast changing data, float percentages,
> > counter integers etc? do i have to use an output box and mess with string
> > conversion and clearing box all time or is there a native printf style 
> > formatted call?
>
>       Just about anything should work including just changing the label of a 
> box.
>
>       String conversion is unavoidable, as somewhere along the line the value
>       has to be converted to a string to be printed. Regardless, the speed of
>       this will be faster than your eye can perceive, and likely faster than
>       the graphics adapter can display the font.
>
>       I'd suggest using sprintf() to a string, and display the string.
>       Use an Fl_Box if you want the data to appear on a background, eg:
>
>               // Init
>               box = new Fl_Box(...);
>               box->box(FL_FLAT_BOX);
>               box->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT);
>
>       ..then whenever you want to update the data to the screen:
>
>               // Your data update callback
>               void UpdateCallback() {
>                   static char s[200];
>                   sprintf(s, "VAL=%d FVAL=%f YVAL=%ld ..", ...);
>                   box->label(s);
>                   box->redraw();
>               }
>
>       You won't have to do the clear, as the label will redraw itself
>       correctly, since the box is an FL_FLAT_BOX and the text is drawn
>       inside the box.
>
>       Or, as Albrecht described, use Fl_Output and friends, which essentially
>       does some of the above for you. But if the string of values you're
>       printing is a complex long printf() style statement, the above is a good
>       way to go with sprintf()/snprintf()/etc.

Yes thanks for the reply, i spotted the sprintf() option while going through 
some of the test folder sample code, it seems to do the trick nicely.
It is early days for me and i need to see how to properly embed my code in an 
event loop, because i asked a for loop to output a count using the method we 
have discussed, the thing is if i put a high count in the window hangs and does 
not display until the count is complete, even though the show() function was 
already called in the constructor,
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to