Ouch...
Is there anyway to use a function in a while instead of Fl::run();
For my application it will be more suited, because I have to make other 
computation, absolutely not related to FLTK.  And I don't want to make this 
computation periodically but all the time.  And only refresh FLTK from time to 
time and when needed.

> If your intention is a continuous redraw (animation, for example), you
> should still use Fl::run() and prepend a call to Fl::add_timeout(). In the
> timout, you call redraw(), and Fl::repeat_timeout()

But the redraw() should be called only to the main window, right?

thanks,
Loic,



> Am 29.05.2009 15:39 Uhr schrieb "Loic" unter <[email protected]>:
> > int main (int argc, char *argv[])
> > {
>
> Well, you have the right idea, but a little confusion in where the commands
> go.
>
> > WIN_MAIN* test = new WIN_MAIN(0,0,800,600,"Test Window");
> > test->resizable(test);
> > test->show();
> >
> > while(test->shown()){
> ^^ this is not needed. FLTK quits the app when the last window is closed
>
> > Fl::check();
> ^^ this is not needed, because it does not do what you want. It handles
> events, but no drawing.
>
> > //test->damage(FL_DAMAGE_ALL);
> > test->redraw();
> ^^ this also does not do what you want. This call merely marks your window
> for drawing "at the next occasion". None of your calls give FLTK the
> occasion to draw anything. The correct call would be Fl::flush()
>
> > }
> ^^ so to put it al into a single call, all you need to do is:
>
> Fl::run();
>
> Instead of the entir "while" loop.
>
> > return 0;
> > }
>
> If your intention is a continuous redraw (animation, for example), you
> should still use Fl::run() and prepend a call to Fl::add_timeout(). In the
> timout, you call redraw(), and Fl::repeat_timeout()
>
>
>

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

Reply via email to