[email protected] wrote:
>   while (run_make->value() == 1) {
>        sleep(1); frame->redraw(); Fl::flush();}

        That loop should probably be:

while (run_make->value() == 1) {
    Fl::wait(0.5);
}

        [Your call to Fl::flush() just flushes the graphics,
        it doesn't yield cpu to FLTK for processing events.]

        *Or*, possibly better, just delete all of this:

----
  sleep(1);
  while (run_make->value() == 1) {
         sleep(1); frame->redraw(); Fl::flush();}
  o->activate(); frame->cursor(FL_CURSOR_DEFAULT);
----

        ..so that the function just returns after the
        Fl::add_fd() so that Fl::run() will take over, keeping
        the interface alive, and HandleFD() will automatically
        be called until all the data is read.

        Then you can return the cursor to normal and reactivate
        the widget by adding these 2 lines just after the pclose():

----
    if ( fgets(results, 1023, G_fp) == NULL ) {
        run_make->value(0);
        Fl::remove_fd(fileno(G_fp));
        pclose(G_fp);
        frame->cursor(FL_CURSOR_DEFAULT);   // ADD THIS LINE
        run_make->activate();               // ADD THIS LINE
        return;
    }
----

        I think that approach is better, at least in this case,
        because there's no reason for the loop; the loop pretty
        much simulates what Fl::run() is already doing for you
        anyway.

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

Reply via email to