FLTK logo

[fltk.general] Use worker thread to call Fl_Window and Fl_run

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Use worker thread to call Fl_Window and Fl_run "anmol.... Sep 30, 2020  
 
Hi. I want to create a simple progress bar, and do not need any user input. I cannot block my main app as it already has its own GUI.
What will happen if I use the following from a worker thread ?

Fl_Window win(220,90);
win.begin(); // add progress bar to it..
Fl_Progress *progress = new Fl_Progress(10,50,200,30);
progress->minimum(0); // set progress range to be 0.0 ~ 1.0
progress->maximum(1);
progress->color(0x88888800); // background color
progress->selection_color(0x4444ff00); // progress bar color
progress->labelcolor(FL_WHITE); // percent text color 50 
win.end();
win.show();
Fl::run();

And I update it from main thread.
progress->value(t/500.0); 
progress->label(percent); // update progress bar's label
Fl::check();

I read the docs, and its clear that the main thread owns the window, but if I dont care about user input, is there any harm in this ?

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/d0b5654f-38f7-429e-b51b-fd032dd4aac3n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.