mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-22 04:38:09 +08:00
Add "frame" : scrollable area.
This commit is contained in:
34
examples/component/radiobox_in_frame.cpp
Normal file
34
examples/component/radiobox_in_frame.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#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() {
|
||||
for(int i = 0; i<30; ++i) {
|
||||
radiobox.entries.push_back(L"RadioBox " + to_wstring(i));
|
||||
}
|
||||
Add(&radiobox);
|
||||
}
|
||||
|
||||
Element Render() override {
|
||||
return radiobox.Render() | frame | size(20,10) | border;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::FitComponent();
|
||||
MyComponent component;
|
||||
screen.Loop(&component);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user