On 16.05.2012 11:29, Rajesh Kumar wrote:
> Hi all,
>
> When I clicked on a button, am incrementing a variable. If that
> variable reaches to some number lets say 50 then a popup window showing the
> value of that variable should appear. After 2 secs the popup window should
> hide. This should happen untill I pressed quit button. Any Ideas????? Am
> using fltk1.3 on ARM processor based linux embedded system.
Well, the first part (incrementing the counter) shouldn't be a problem.
When the limit is reached, you can use something like this:
// timer callback to close the window
void close_window(void *w) {
Fl_Window *win = (Fl_Window *w);
win->hide();
}
// code to open the popup window and start the timer
popup_window->show();
Fl::add_timeout(2.0,close_window,popup_window);
This doesn't address the quit button, though. Do you want this button
to be in the popup window? If that's true, then you will probably have
to write a short loop like this one in your callback:
// code to open the popup window and start the timer
popup_window->show();
Fl::add_timeout(2.0,close_window,popup_window);
while (popup_window->visible()) {
Fl::wait();
}
Use the quit button to call the close_window() function, then the
window would be hidden. In this case, however, you should also call
Fl::remove_timeout() to remove the pending timer.
Try this with a simple program, and if you have further questions,
please post your code, so that we can help you.
Albrecht
P.S. I'm not going to write a complete program for you ;-)
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk