John Hoare wrote:

> Is there an example of an fltk program that does not always have a window 
> open, and exists beyond that of the fltk window's life. (All the examples 
> seem to end once the window is closed.)

use test/hello.cxx with this patch:

$ svn diff hello.cxx ; make hello.exe && ./hello
Index: hello.cxx
===================================================================
--- hello.cxx   (revision 8078)
+++ hello.cxx   (working copy)
@@ -29,6 +29,11 @@
  #include <FL/Fl_Window.H>
  #include <FL/Fl_Box.H>

+void timer_cb ( void * ) {
+  printf ("#"); fflush(stdout);
+  Fl::repeat_timeout(1.0,timer_cb);
+}
+
  int main(int argc, char **argv) {
    Fl_Window *window = new Fl_Window(300,180);
    Fl_Box *box = new Fl_Box(FL_UP_BOX,20,40,260,100,"Hello, World!");
@@ -37,7 +42,14 @@
    box->labeltype(FL_SHADOW_LABEL);
    window->end();
    window->show(argc, argv);
-  return Fl::run();
+  //return Fl::run();
+
+  printf ("Executing Fl::run() ..."); fflush(stdout);
+  Fl::run();
+  printf ("\nAfter Fl::run() ..."); fflush(stdout);
+  Fl::add_timeout(3.0,timer_cb);
+  while (true) { Fl::wait( 10.0 ); }
+
  }

  //
Executing Fl::run() ...
After Fl::run() ...############

(aborted with CTRL/C).

Note that there's a 3 sec. delay after closing the window, and then
I get one '#' every second.

Example compiled and run on Windows XP, FLTK 1.3, svn r8078, MinGW

Is this what you asked for?

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

Reply via email to