On Jun 20, 2007, at 11:55 AM, FLTK is NICE wrote:

> I am trying to push a lot of chars into Fl_Text_Display via  
> Fl_Text_Buffer in a short amount of time.

If you push individual characters during a callback or whatever,  
simply returning (or calling redraw()) should de the job. The screen  
should not be redraw more often than 25 times a second, which still  
looks real-time, but consumes much less cpu cycles than drawing after  
*every* character. Fl::flush(), for example, would redraw much more  
often than needed.

If that doesn't fix the problems, there are a few more tricks in the  
box:

You can figure out how many characters can be received before adding  
them to the bufer, so that the flow still looks real tim (for  
example, at 19200bps, you would receive 1920 characters per second;  
the human eye perceives 25 frames as a continous motions, so 1920/25  
= 76, so you can receive 76 characters in a fast (static) buffer, and  
then add them to the FlText_Display all at once, avoiding 75  
rellocation calls.

If there is no fixed rate, you can set a timer that will copy all  
characters received into the Fl_Text_Display every 1/25 seconds,  
using fl_add_timeout.

Also, try Fl_Multiline_Input. It's a much simpler widget that might  
reder quicker, but does not show a scroll bar.

And then you could write you own little widget with a static text  
buffer, which sets a "redraw()" every time a character is received,  
and then have a custom "draw()" function that is very fast.

> I must thank the people how created FLTK and maintain it. It's by  
> far the best gui for cross-OS coding, super slim and right to the  
> point. But please let fltk.org get a better forum.

Thanks

  Matthias

----
http://robowerk.com/


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to