Added a callback on selection change

This commit is contained in:
Clement Roblot
2024-12-02 15:40:50 +07:00
committed by ArthurSonzogni
parent 70a6a04e80
commit dc70091203
3 changed files with 43 additions and 2 deletions

View File

@@ -27,12 +27,18 @@ Element LoremIpsum() {
int main() {
auto screen = ScreenInteractive::TerminalOutput();
int counter = 0;
screen.onSelectionModified([&]{
counter++;
});
auto quit = Button("Quit", screen.ExitLoopClosure());
// The components:
auto renderer = Renderer(quit, [&] {
return vbox({
text("Select: " + std::to_string(counter)),
window(text("Horizontal split"), hbox({
LoremIpsum(),
separator(),