FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
input_in_frame.cpp
Go to the documentation of this file.
1// Copyright 2021 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#include <memory> // for allocator, __shared_ptr_access
5#include <string> // for string, basic_string, operator+, to_string
6#include <vector> // for vector
7
8#include "ftxui/component/captured_mouse.hpp" // for ftxui
9#include "ftxui/component/component.hpp" // for Input, Renderer, Vertical
10#include "ftxui/component/component_base.hpp" // for ComponentBase
11#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
12#include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, vscroll_indicator, HEIGHT, LESS_THAN
13
14int main() {
15 using namespace ftxui;
16
17 Component input_list = Container::Vertical({});
18 std::vector<std::string> items(100, "");
19 for (size_t i = 0; i < items.size(); ++i) {
20 input_list->Add(Input(&(items[i]), "placeholder " + std::to_string(i)));
21 }
22
23 auto renderer = Renderer(input_list, [&] {
24 return input_list->Render() | vscroll_indicator | frame | border |
25 size(HEIGHT, LESS_THAN, 10);
26 });
27
28 auto screen = ScreenInteractive::TerminalOutput();
29 screen.Loop(renderer);
30}
int main()
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
std::shared_ptr< ComponentBase > Component