Comments (5)
Hello, I do not understand you. Could you please try again?
from ftxui.
I did have some questions to ask, but I made a mistake and published them without editing them. Then something happened, and I went to a meeting, and I didn't continue to edit. I am not a native English speaker, I want to express my sincerest apologies, but I can't speak English, I can only use translation software to translate, and I am a college student, not very good at technology, so the following questions, perhaps in your opinion will be relatively simple. Finally, I sincerely apologize. Next, I get to the point.
There is a question with a urge to ask. The prompt is related to the display of ASCLL art characters. This has to do with issue#336. You said you were going to enhance paragraph, but I don't seem to have found that paragraph resolves the line break "\n". But fortunately, I found that you gave a more suitable solution. I adopted it, and it worked fine. But I hope you can improve the functionality of paragraph.
As for the problem, it is as follows.
here is my codes, there are two version, and version 1 can work successful, version 2 not.
// version1
void Module::start()
{
auto screen = ScreenInteractive::Fullscreen();
// Start
Option selected = Log;
auto menu = Container::Horizontal({
Button("Log",[&]{ selected = Log; },ButtonOption::Ascii()),
Button("Sign",[&]{ selected = Sign; },ButtonOption::Ascii()),
Button("Help",[&]{ selected = Help; },ButtonOption::Ascii()),
Button("Exit",[&]{ selected = Exit; },ButtonOption::Ascii()),
});
//auto start_container = vbox({
// hcenter(nonWrappingParagraph(LOGO)),
// hcenter(menu->Render()) | bold
// }) | center | border | color(Color::Blue);
auto start_render = Renderer(menu, [&](){
// return start_container;
return vbox({
hcenter(nonWrappingParagraph(LOGO)),
hcenter(menu->Render()) | bold
}) | center | border | color(Color::Blue);
});
// version 2
void Module::start()
{
auto screen = ScreenInteractive::Fullscreen();
// Start
Option selected = Log;
auto menu = Container::Horizontal({
Button("Log",[&]{ selected = Log; },ButtonOption::Ascii()),
Button("Sign",[&]{ selected = Sign; },ButtonOption::Ascii()),
Button("Help",[&]{ selected = Help; },ButtonOption::Ascii()),
Button("Exit",[&]{ selected = Exit; },ButtonOption::Ascii()),
});
auto start_container = vbox({
hcenter(nonWrappingParagraph(LOGO)),
hcenter(menu->Render()) | bold
}) | center | border | color(Color::Blue);
auto start_render = Renderer(menu, [&](){
return start_container;
//return vbox({
// hcenter(nonWrappingParagraph(LOGO)),
// hcenter(menu->Render()) | bold
//}) | center | border | color(Color::Blue);
});
you can see that , I just use a auto start_render
to receive vbox()
. in lambda, it works, in outside it doesn't . the result of version 2, it can't choose the button by key h or l. but in version 1,it can choose the button by key h or l(that was what I want to get)
so what happened ? why version 2 can't work ? I had read some source code , due to I'm a rookie.I can't get any useful things for me .
In my country, it is very late now, so I need to go to bed, but in your country, it should be daytime now, so I may reply you after several hours, please forgive me, thank you
from ftxui.
well, by the way, the ftxui is so awesome! so I want to use it to develop a communication software , and use the operation like vi/vim(I like vim too, and I use arch), and I want to know that ,Is it really popular? if I done, Will full keyboard streamers like it?
from ftxui.
Thanks!
I am not a native English speaker, I want to express my sincerest apologies, but I can't speak English.
Don't worry. Me too ;-)
So what happened ? why version 2 can't work ?
In v2, the same element is reused to draw multiple frames. Even if it might work, this is not supported. You should create a new one for every frames.
from ftxui.
Oh, I see what you mean. That said, it was possible for my version 1 to write vbox in lambda because lambda returns a different value each time it is rendered. Thus, it will show different effects, which is why it is necessary to write vbox in lambda. If it is not written in lambda, then no matter how many times it is rendered, the return value will not change, and it is always the outside start_container, so if it is written outside, it is theoretically OK, but it will cause the interface to render the same content many times, and it looks like there is no change.
非常感谢您的回复与耐心,Merci pour votre;-)
from ftxui.
Related Issues (20)
- Allow Canvas re-use for optimization HOT 3
- How to remove focus from an element when hovering with the mouse pointer? HOT 2
- Run-Time Check Failure: Stack Corruption of 'option' Variable HOT 5
- Adding elements in loop HOT 1
- [HELP] - Menu inside frame goes to the top when unfocused HOT 3
- Problems with `Menu`? HOT 2
- When moving the mouse inside the application, a sequence of control characters of the terminal appears. HOT 7
- Improper exiting with signals
- how to make Dropdown without border HOT 1
- when will release new version HOT 2
- 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 1
- 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 1
- Untidy exit on std::terminate()
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.