Hi Albrecht,
I did it with fltk2.0, reason is a few days before only I
migrate to FLTK1.3. I thought I will complete test code in fltk2.0 in
faster way.
Here is the test code,
//Header files included
using namespace fltk;
void doexit(fltk::Widget *, void *);
int main_menu(void);
int i = 0;
Window * win;
fltk::Group* aaa;
void doexit(fltk::Widget *, void *) {
exit(0);
}
void test(void)
{
while(1) {
i++;
if( i%10 == 0 ) {
win->show();
sleep(2);
win->hide;
fprintf(stderr, "\nTesting.........%d\n", i);
sleep(1);
}
}
}
int main_menu(void)
{
aaa = new fltk::Group(0, 0, 240, 320, "startup");
aaa->set_vertical();
aaa->begin();
{
fltk::Button* o = new fltk::Button(60, 140, 100, 20, "Logout");
o->buttoncolor((fltk::Color)0x8eabe000);
o->highlight_color((fltk::Color)0x8797e000);
o->callback(doexit);
}
test();
}
int main (int argc, char **argv) {
fltk::Window *w;
{
fltk::Window* o = new fltk::Window(5, 21, 250, 266, "Demo");
w = o;
o->set_vertical();
o->box(fltk::BORDER_BOX);
o->buttonbox(fltk::FLAT_BOX);
o->labelfont(fltk::TIMES_BOLD);
o->textfont(fltk::TIMES);
o->labeltype(fltk::ENGRAVED_LABEL);
o->color((fltk::Color)0xe0d0da00);
o->selection_color((fltk::Color)0xff00);
o->selection_textcolor((fltk::Color)56);
o->buttoncolor((fltk::Color)0xe08b8100);
o->shortcut(0xff1b);
o->begin();
{
win = new fltk::Window(0, 0, 240, 320, "child window");
win->hide();
}
main_menu(); //initial menu
o->end();
o->resizable(o);
}
w->show(argc, argv);
return fltk::run();
}
What I am doing is when i%10 becomes I want to show a separate
window, just for two seconds. So this block of code will do it.
i++;
if( i%10 == 0 ) {
win->show();
sleep(2);
win->hide;
fprintf(stderr, "\nTesting.........%d\n", i);
sleep(1);
There I am just showing a separate window and giving 2secs delay the
hiding it. But when I compile it throwing error "statement cannot resolve
address of overloaded function" . What should I change????
On Wed, May 16, 2012 at 3:19 PM, Albrecht Schlosser
<[email protected]>wrote:
> 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
>
--
*
Thanks & Regards,
Rajesh Kumar P
*
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk