FTXUI/examples/component/radiobox_in_frame.cpp

35 lines
834 B
C++
Raw Normal View History

2019-01-20 05:06:05 +08:00
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/container.hpp"
#include "ftxui/component/input.hpp"
#include "ftxui/component/menu.hpp"
#include "ftxui/component/radiobox.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/toggle.hpp"
#include "ftxui/screen/string.hpp"
using namespace ftxui;
class MyComponent : public Component {
RadioBox radiobox;
public:
MyComponent() {
2020-03-23 05:32:44 +08:00
for (int i = 0; i < 30; ++i) {
2019-01-20 05:06:05 +08:00
radiobox.entries.push_back(L"RadioBox " + to_wstring(i));
}
Add(&radiobox);
}
Element Render() override {
return radiobox.Render() | frame | size(HEIGHT, LESS_THAN, 10) | border;
2019-01-20 05:06:05 +08:00
}
};
int main(int argc, const char* argv[]) {
auto screen = ScreenInteractive::FitComponent();
MyComponent component;
screen.Loop(&component);
return 0;
}