hi

i'm developing a small software for neuronal image analysis. I have a problem 
using fltk callbacks:

i have a main class containing my GUI, and the callbacks for the GUI as member 
functions (through the "static/inline" pair of functions, as  described in doc)

here's the deal: when the user hits the "filter" button on my gui, i'd like a 
new window to open, presenting some filtering options; then the user hits "run" 
on that window, and image filtering is in process.

so far my code is:

[in my main class.cpp]
..
void Filter_callback(){
filterWindow->show(); //filterWindow derives from Fl_Window
image->Filter(filterWindow->GetFilterParameters());
}
..

the problem is that the filterWindow will only show after completing the whole 
Filter_callback, so i can't retrieve my filterparameters as the user hasn't had 
the chance yet to see those parameters.

i have thought of several solutions:

1. some way to interrupt the current callback (Filter_callback) in order to 
actually show my filterWindow and wait for this filterwindow callbacks. The 
rest of Filter_callback would then be executed as user hits 'run' on the 
filterWindow, which then disappears. Is there a way to do that with fltk ?

2. add some kind of observer so that my Filter_callback would only have to show 
my filterwindow, and change some member variable that would be observed by 
Fl::run(). That way, filter_callback completes and my filterWindow is shown; 
then Fl::run sees my variable has changed, thus calls some function to perform 
my filtering. is it possible to do so with fltk ? (i searched on add_fd, 
handler() etc in fltk, but i'm not sure how these functions work...)

3. pass a pointer to my main class when creating my filterWindow; i tried this, 
but still getting compilation errors (i'll be more specific if that's the 
solution i have to choose, but i'd rather avoid that)

4. think of a whole new OO design... something like having a class just for 
handling all callbacks coming from any window of my program... but that means i 
still have to find a way to make a callback communicate with a function 
declared in his parent...

5. any idea ??


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

Reply via email to