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.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to