examples/component/menu.cpp

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<functional>//forfunction
    #include<iostream>//forbasic_ostream::operator<<,operator<<,endl,basic_ostream,basic_ostream<>::__ostream_type,cout,ostream
    #include<string>//forstring,basic_string,allocator
    #include<vector>//forvector

    #include"ftxui/component/captured_mouse.hpp"//forftxui
    #include"ftxui/component/component.hpp"//forMenu
    #include"ftxui/component/component_options.hpp"//forMenuOption
    #include"ftxui/component/screen_interactive.hpp"//forScreenInteractive

    intmain(){
    usingnamespaceftxui;
    autoscreen=ScreenInteractive::TerminalOutput();

    std::vector<std::string>entries={
    "entry1",
    "entry2",
    "entry3",
    };
    intselected=0;

    MenuOptionoption;
    option.on_enter=screen.ExitLoopClosure();
    automenu=Menu(&entries,&selected,option);

    screen.Loop(menu);

    std::cout<<"Selectedelement="<<selected<<std::endl;
    }