Skip to content

Menu or button does not work in component #1051

Answered by ArthurSonzogni
SLHome asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @SLHome

workspace_input isn't linked to window. So the OnEvent isn't propagated properly.

You might want to call "Add(...)" to make workspace_input the parent of window.

What about:

class workspace_input : public ftxui::ComponentBase
{
    Component                           window{Container::Vertical({})};
    Component                           menu{Container::Horizontal({})};
    Component                           log{Container::Vertical({})};

  public:
    workspace_input()
    {
        menu->Add(Button("Clear", [this]() { log->DetachAllChildren(); }, button_style));
        menu->Add(Button("Close", [this]() { Detach(); }, button_style));
        window->Add(menu);
        w…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by SLHome
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants