Comments (5)
Is it possible to dynamically add elements/children to checkmarks like this?
Yes it is possible.
I will take a look later today.
Maybe you can upload a video or a terminal record reproducing what you are seeing? In particular the crash?
from ftxui.
Absolutely. It is random generally, but I happened to capture it in the first try. Usually it happens immediately, but in this case, it took some tries.
You can find the source code here: source If you want to look further in depth of my implementation, beyond the code I posted here.
and here is the recording. terminal record
from ftxui.
Here's a link to the asciinema to play it, if the above recording doesn't work correctly:
[recording](
the animator)
from ftxui.
Hello,
After some time, I've managed to have clients display dynamically as text, seen below:
But I cannot get them to show up as actual checkboxes, only text, when trying with the following code, the list shows just empty.
// -- client list
// ----------------------------------------------------------------------
std::array<bool, 10> states;
auto lister = Renderer([&] {
auto checkboxes = Container::Vertical({});
Elements children = {};
for (size_t i = std::max(0, (int) clientVec.vec.size() - 9); i < clientVec.vec.size(); ++i) {
std::lock_guard<std::mutex> lock(clientVec.vecMutex);
children.push_back(text(clientVec.vec[i]));
checkboxes->Add(Checkbox(clientVec.vec[i], &states[i]));
};
return vbox(checkboxes) | size(HEIGHT, EQUAL, 3);
});
lister = Wrap("Clients", lister);
I'm unsure why this doesn't work...though my guess is that the checkboxes need to be updated/passed to the renderer in a different way.
Do you have any code examples/suggestions?
I have also since updated the source code to use cmake for compiling, should you want to look at the project again.
from ftxui.
I have successfully added achieved the checkboxes to update dynamically, with the following code:
std::array<bool, 10> states;
auto lister = Renderer([&] {
Component clist = Container::Vertical({});
for (size_t i = std::max(0, (int) clientVec.vec.size() - 9); i < clientVec.vec.size(); ++i) {
std::lock_guard<std::mutex> lock(clientVec.vecMutex);
clist ->Add(Checkbox(clientVec.vec[i], &states[i]));
};
return clist->Render() | size(HEIGHT, EQUAL, 3) | vscroll_indicator ;
});
```
from ftxui.
Related Issues (20)
- when will release new version HOT 4
- Simulate a timeline HOT 2
- dropdown example bugs HOT 2
- Creating an input window, and outputting entered text after hitting enter or special key. HOT 3
- how to hide the cursor HOT 2
- About Support for Full width Characters in FTXUI HOT 10
- Is there an Event handling when CTRL+SHIFT+C is pressed? HOT 2
- From ftxui::Element to std::string or char* HOT 3
- focus problem HOT 2
- Untidy exit on std::terminate() HOT 1
- Do you have any recommended fonts? The font provided by windows is not very beautiful HOT 2
- How to highlight text inside ftxui::text() or ftxui::paragraph() HOT 1
- Is there a bug between full width characters and vertical?
- Running tests alters the terminal state HOT 2
- The scrollbar doesn't work in the "homescreen.cpp" demo HOT 3
- [feature request] Scatter plots HOT 1
- Correctness of layout requirement for flexbox. Scrollbar implementation. HOT 1
- I've tried everything. I need help HOT 1
- Compression priority when rendering a vbox with inadequate space. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ftxui.