ftxui::Loop
#include <ftxui/component/loop.hpp>Loop is a class that manages the event loop for a component.
It is responsible for running the component, handling events, and updating the screen.
The Loop class is designed to be used with an App object, which represents the terminal screen.
Example
#include <ftxui/component/component.hpp>
#include <ftxui/component/app.hpp>
#include <ftxui/component/loop.hpp>
int main() {
auto screen = ftxui::App::TerminalOutput();
auto component = ftxui::Button("Click me", [] { ... });
ftxui::Loop loop(screen.get(), component);
// Either
loop.Run(); // Blocking until the component quits.
// Or
loop.RunOnce(); // Non-blocking, returns immediately.
// Or
loop.RunOnceBlocking(); // Blocking until handling one event.
// Or in a loop:
while (!loop.HasQuitted()) {
loop.RunOnce();
// Do something else like running a different library loop function.
}
}Examples: component/button, component/button_animated, component/button_in_frame, component/button_style, component/canvas_animated, component/checkbox, component/checkbox_in_frame, component/collapsible, component/composition, component/custom_loop, component/dropdown, component/dropdown_custom (+41 more)
Summary
| Symbol | Description |
|---|---|
Loop | |
~Loop | |
HasQuitted | |
RunOnce | |
RunOnceBlocking | |
Run | |
operator= |
Public Member Functions
Loop
Examples: component/button, component/button_animated, component/button_in_frame, component/button_style, component/canvas_animated, component/checkbox, component/checkbox_in_frame, component/collapsible, component/composition, component/custom_loop, component/dropdown, component/dropdown_custom (+41 more)
~Loop
~Loop();HasQuitted
bool HasQuitted();RunOnce
void RunOnce();RunOnceBlocking
void RunOnceBlocking();Run
void Run();operator=
operator=
Loop
Examples: component/button, component/button_animated, component/button_in_frame, component/button_style, component/canvas_animated, component/checkbox, component/checkbox_in_frame, component/collapsible, component/composition, component/custom_loop, component/dropdown, component/dropdown_custom (+41 more)
Loop
Examples: component/button, component/button_animated, component/button_in_frame, component/button_style, component/canvas_animated, component/checkbox, component/checkbox_in_frame, component/collapsible, component/composition, component/custom_loop, component/dropdown, component/dropdown_custom (+41 more)