diff --git a/include/nana/gui/wvl.hpp b/include/nana/gui/wvl.hpp index a55ec00b..aac2319e 100644 --- a/include/nana/gui/wvl.hpp +++ b/include/nana/gui/wvl.hpp @@ -60,7 +60,7 @@ namespace nana template using form_loader = detail::form_loader; - void exec(unsigned wait = 0, std::function = {}); + void exec(unsigned wait = 0, std::function = {}, unsigned wait_end=0, form *fm= nullptr); }//end namespace nana #endif diff --git a/source/gui/wvl.cpp b/source/gui/wvl.cpp index 912bc3ef..621e9c4c 100644 --- a/source/gui/wvl.cpp +++ b/source/gui/wvl.cpp @@ -18,8 +18,6 @@ #include -//#define NANA_AUTOMATIC_GUI_TESTING - inline unsigned Wait(unsigned wait = 0) { #ifdef NANA_AUTOMATIC_GUI_TESTING @@ -39,7 +37,7 @@ namespace nana } } - void exec(unsigned wait, std::function f ) + void exec(unsigned wait, std::function f, unsigned wait_end, form *fm ) { #ifdef NANA_ADD_DEF_AUTOMATIC_GUI_TESTING if (!wait) @@ -51,16 +49,21 @@ namespace nana wait = Wait(wait); std::cout << "Will wait " << wait << " sec...\n"; - std::thread t([wait, &f]() + std::thread t([wait, &f, wait_end, fm]() { if (wait) { std::cout << "Waiting " << wait << " sec...\n"; std::this_thread::sleep_for(std::chrono::seconds{ wait } ); - std::cout << "Waited !! running... \n" ; + std::cout << "running... \n" ; f(); - //API::exit(); - std::cout << "Runed... \n"; - } + std::cout << "Done... \n"; + std::cout << "Now waiting anothers " << wait << " sec...\n"; + std::this_thread::sleep_for(std::chrono::seconds{ wait_end } ); + std::cout << "Done... \n"; + if (fm) + fm->close(); + API::exit(); // why not works? + } }); detail::bedrock::instance().pump_event(nullptr, false);