|
|
On 2020-09-30 13:54, Ian MacArthur wrote:
> However, the key here is that you do not need to call Fl::run() at all, if you only want to drive the GUI from your main thread: all you have to do is call Fl::wait(0); every now and then (say every 100ms or so if you just want to update the GUI but not handle user input...)
I believe we have an example of this in examples/progress-simple.cxx, which shows:
[..]
// Computation loop needing an updating progress indicator..
for ( int t=1; t<=500; t++ ) {
progress->value(t/500.0); // update progress bar with 0.0 ~ 1.0 value
char percent[10];
sprintf(percent, "%d%%", int((t/500.0)*100.0));
progress->label(percent); // update progress bar's label
Fl::check(); // give fltk some cpu to update the screen
usleep(1000); // <-- your compute intensive stuff goes here
}
[..]
--
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/944a5b7f-a1ab-87fb-bfc5-3a043ef67657%40seriss.com.
[ Direct Link to Message ] | |
|
| |