16 using namespace ftxui;
18 auto screen = ScreenInteractive::Fullscreen();
23 auto btn_run = Button(
"Execute with restored IO", screen.WithRestoredIO([] {
24 std::cout <<
"This is a child program using stdin/stdout." << std::endl;
25 for (int i = 0; i < 10; ++i) {
26 std::cout <<
"Please enter 10 strings (" << i <<
"/10)" << std::flush;
28 std::getline(std::cin, input);
32 auto btn_quit = Button(
"Quit", screen.ExitLoopClosure());
34 auto layout = Container::Horizontal({
39 auto renderer = Renderer(layout, [&] {
40 auto explanation = paragraph(
41 "After clicking this button, the ScreenInteractive will be "
42 "suspended and access to stdin/stdout will temporarilly be "
43 "restore for running a function.");
45 explanation | borderEmpty,
53 element = element | borderEmpty | border | size(WIDTH, LESS_THAN, 80) |
54 size(HEIGHT, LESS_THAN, 20) | center;
58 screen.Loop(renderer);