16 using namespace ftxui;
18 auto screen = ScreenInteractive::Fullscreen();
23 auto btn_run = Button(
"Ejecutar con E/S restaurada",
screen.WithRestoredIO([] {
24 std::cout <<
"Este es un programa hijo usando stdin/stdout." << std::endl;
25 for (int i = 0; i < 10; ++i) {
26 std::cout <<
"Por favor, introduce 10 cadenas (" << i <<
"/10)" << std::flush;
28 std::getline(std::cin, input);
32 auto btn_quit = Button(
"Salir",
screen.ExitLoopClosure());
34 auto layout = Container::Horizontal({
39 auto renderer = Renderer(layout, [&] {
40 auto explanation = paragraph(
41 "Después de hacer clic en este botón, ScreenInteractive se "
42 "suspenderá y el acceso a stdin/stdout se restaurará temporalmente "
43 "para ejecutar una función.");
45 explanation | borderEmpty,
53 element = element | borderEmpty | border |
size(WIDTH, LESS_THAN, 80) |
54 size(HEIGHT, LESS_THAN, 20) | center;
return hbox({ text(std::to_string(int(progress *100))+"% ")|size(WIDTH, EQUAL, 5), gauge(progress), })