mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
We can retrieve the content of the selection
This commit is contained in:
committed by
ArthurSonzogni
parent
dc70091203
commit
307d8b51bf
@@ -27,18 +27,16 @@ Element LoremIpsum() {
|
||||
|
||||
int main() {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
int counter = 0;
|
||||
|
||||
screen.onSelectionModified([&]{
|
||||
counter++;
|
||||
});
|
||||
int selectionChangeCounter = 0;
|
||||
std::string selection = "";
|
||||
|
||||
auto quit = Button("Quit", screen.ExitLoopClosure());
|
||||
|
||||
// The components:
|
||||
auto renderer = Renderer(quit, [&] {
|
||||
return vbox({
|
||||
text("Select: " + std::to_string(counter)),
|
||||
text("Select changed: " + std::to_string(selectionChangeCounter) + " times"),
|
||||
text("Currently selected: " + selection),
|
||||
window(text("Horizontal split"), hbox({
|
||||
LoremIpsum(),
|
||||
separator(),
|
||||
@@ -75,5 +73,10 @@ int main() {
|
||||
});
|
||||
});
|
||||
|
||||
screen.onSelectionModified([&] {
|
||||
selectionChangeCounter++;
|
||||
selection = screen.GetSelectedContent(renderer);
|
||||
});
|
||||
|
||||
screen.Loop(renderer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user