Giter VIP home page Giter VIP logo

Comments (5)

ArthurSonzogni avatar ArthurSonzogni commented on June 2, 2024

Hello, I do not understand you. Could you please try again?

from ftxui.

dty2 avatar dty2 commented on June 2, 2024

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.

dty2 avatar dty2 commented on June 2, 2024

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.

ArthurSonzogni avatar ArthurSonzogni commented on June 2, 2024

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.

dty2 avatar dty2 commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.