|
|
Forking a new process may be a bit heavyweight for my needs. Its more intensive on Windows than on *NIX. I looked at the progress_simple example, and ended up using check() - which is wait(0).
static int AEC_progress = 0;
// Progress callback updates label void Update_CB(void* userdata) { Fl_Progress* progress = (Fl_Progress*)userdata; int val; val = AEC_progress; progress->value((float)val); // update progress bar with 0.0 ~ 100 value char percent[10] = { "" }; sprintf_s(percent, "%d%%", val); progress->label(percent); Fl::repeat_timeout(2.0, Update_CB, (void*)progress); }
int main() { float mult = 100.f / (total_frames-1); Fl_Window win(220, 90); // create parent window win.begin(); // add progress bar to it.. Fl_Progress progress (10, 50, 200, 30); progress.minimum(0); // set progress range to be 0.0 ~ 100 progress.maximum(100); progress.color(0x88888800); // background color progress.selection_color(0x4444ff00); // progress bar color progress.labelcolor(FL_WHITE); // percent text color progress.label("0%%"); win.end(); Fl::add_timeout(2.0, Update_CB, (void*)&progress); win.show();
// Loop AEC_progress = (int)(i * mult); Fl::check(); // End Loop
}
This works well with the bar indicator, but the text shows some junk. Also, this window goes to the background.
Any suggestions to force this window to the top of all other windows? My GUI (code that I cannot change) may be pushing a cmd window to the top as I am using popen/pclose and windows starts a cmd window when you use pipes.
On Thursday, October 1, 2020 at 3:02:07 AM UTC+5:30 pdh...@compintensehpc.com wrote:
In case it might be of interest, I have also had success doing FLTK things from the main thread in a parent process and the main thread in a child subprocess(es) that are coordinating via a 2-way Unix pipe. Effectively, multiple FLTK heavyweight threads doing graphics operations in a coordinated way. Actually performs well. Of course, this is on Linux. I believe this obviates any need for locking as is required for lightweight (same process) threads.
--
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/8e3ff31d-2437-45c4-b163-26816bad8cd3n%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |