blessed icon indicating copy to clipboard operation
blessed copied to clipboard

why checkboxes are overwritten?

Open felipenmoura opened this issue 10 years ago • 2 comments

I have a box that is shown when the user hits a shortcut. It looks like a model, centred in the screen. And I want to have a list of checkboxes inside it.

What happens is that I only see the last checkbox, as if it had replaced all the others! I tried using list and form, and it happens the same way!

let cbs = {
            logs: blessed.checkbox({
                // for some reason, the "]" does not appear either!
                // that's why I am adding it to the label
                label: "] Logs",
                checked: false,
                mouse: true
            }),
            warns: blessed.checkbox({
                label: "] Warns",
                checked: false,
                mouse: true
            }),
            errors: blessed.checkbox({
                label: "] Errors",
                checked: false,
                mouse: true
            })
};

// filterBox is the modal box
screen.append(filterBox);
filterBox.append(cbs.logs);
filterBox.append(cbs.warns);
filterBox.append(cbs.errors);
screen.render();

I tried changing the order and also repeating the .render() call, but nothing makes it work!

By the way, I am using the blessed-contrib, too.

Any idea on what could it be?!

felipenmoura avatar Mar 09 '16 02:03 felipenmoura

I spent some time on it and I figured that they are not overridden, they are rendered on top of each other. Try to apply an incremental top value to each one of them and you should get see them :)

cedmax avatar Apr 26 '17 13:04 cedmax

Btw, regarding:

                // for some reason, the "]" does not appear either!
                // that's why I am adding it to the label
                label: "] Logs",

It's because you should be using the text property, not label.

jfrej avatar Oct 26 '18 22:10 jfrej