Hello all,

Is it possible to update a window without checking for user generated events
(mouse, keyboard, wm)?

I have a program (1 Fl_Double_Window) that does a lengthy calculation. At
the bottom I have a Fl_Progress bar appear during the calculation. While
the calculation is underway, Fl::check() is called so that the Fl_Progress
will be updated. The calculation can be customised by the user by
manipulating a couple of sliders. Upon completing the slider adjustment
(FL_WHEN_RELEASED), the calculation is started and result is displayed at
the end.

My problem (most likely due to bad design?) is that if the user users the
slider a segfault occurs. I believe it's because of the calls to
Fl::check(). To my credit, I did write a Fl_Progress_Window that was modal.
The window would appear at the start of the operation. Thus, this was never
a problem. I changed to the progressbar at the bottom of the app. since I
thought it looked "neat" :S.

What are some possible ways I can handle this?

So far I have been thinking of:

1. Using Fl::grab() on a hidden window. At the start of the
calculation, "grab" the window which, if I read the docs right, would
prevent the user events. Upon completion, I would ungrab the window.

2. Using some kind of semaphore/lock method. Basically, I set a "busygoaway"
flag to true. Then, in the slider's callback, if "busygoaway" is set, do
not allow the slider to be changed. This may work, but what if the input
file is closed by the user during the calculation. I guess I would need to
check the "busygoaway" flag in every possible operation??

3. ????

Thanks for any ideas,

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

Reply via email to