FLTK logo

[fltk.general] Re: New callback directly in command, difficulty

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: New callback directly in command, difficulty Apprentice Jan 26, 2022  
  OBS: I can not use an exit (0);
For this would leave the program, instead of returning the main window open behind her!

Em quarta-feira, 26 de janeiro de 2022 às 10:54:45 UTC-3, Apprentice escreveu:
Trying new callback directly in command

Wininformations is created provisionally to show a msg, and then I want to remove it completely from memory.

I can not make callback recognize WinInformations. So I can close it.

And I also can not keep the window open for a few seconds because using the sleep command the window is not shown before, as it should!

Is it possible to do that?
Thanks!

{ Fl_Window *WinInformations = new Fl_Window(230, 100);
   WinInformations->border(0);
   WinInformations->position((WinGrid->w() - WinInformations->w())/2 + WinGrid->x(), (WinGrid->h() - WinInformations->h())/2 + WinGrid->y());
   WinInformations->set_modal();

   { Fl_Button *BtExit = new Fl_Button(90, 60, 60, 25);
      BtExit->label("Exit");
      //BtExit->callback([](Fl_Widget*, void*) {WinInformations->hide();}); // NO WORK

      //BtExit->callback([WinInformations](Fl_Widget*, void*) {WinInformations->hide();}); // NO WORK

      BtExit->callback([](Fl_Widget*, void *WinInformations) {
         Fl_Window *Win = (Fl_Window*)WinInformations;
         //Win->hide(); // Segmentation fault
         //delete Win; // NO WORK
      });

   }
   WinInformations->show();
   //sleep(10); // Does not display the above window with this sleep
   //WinInformations->hide();
}

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/c0d31a50-75d7-473a-bb76-085843eb060bn%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.