Hi MacArthur,
Yes, the code is not at all working. I am trying to implement this
task with add_timeout() function. Thanks for the ultimate support ans
guidelines.
On Wed, May 16, 2012 at 4:18 PM, MacArthur, Ian (SELEX GALILEO, UK) <
[email protected]> wrote:
> Commentary below:
>
>
> > void doexit(fltk::Widget *, void *) {
> > exit(0);
> > }
>
>
> You would do better to walk the window list and hide them in turn, just
> calling exit() is a bit rough - though it works fine of course.
>
>
> > void test(void)
> > {
> > while(1) {
> > i++;
> > if( i%10 == 0 ) {
> > win->show();
> > sleep(2);
> > win->hide;
> > fprintf(stderr, "\nTesting.........%d\n", i);
> > sleep(1);
> > }
> > }
> > }
>
> You can't call sleep from within the callback methods - that will halt the
> event loop, stopping your program. You need to use timers; see
> Fl::add_timeout(..) for reference.
>
>
>
> > 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();
> > }
>
> What do you think this piece of code is doing?
>
> Where do you end the aaa group?
>
> Also, this function is spec'd to return an int, but it does not return
> anything, so I'm surprised your compiler didn't complain.
>
> This function, and therefore your test() function, are called before you
> have shown any wondow. What do you expect that to achieve?
>
>
>
> > 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.
>
> No, it will not - you can't use sleep() in this function. Use a timer.
>
> >
> > 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????
>
> Lots - there seem to be many things awry in this code; can you post
> something that is clearer, so we can advise better?
>
>
>
> SELEX Galileo Ltd
> Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex
> SS14 3EL
> A company registered in England & Wales. Company no. 02426132
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************
>
> _______________________________________________
> 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