javascript - Blessed List Failing -
javascript - Blessed List Failing -
i trying create simple listbox.
var blessed = require("blessed"); // create screen object. var screen = blessed.screen(); // create box centered horizontally , vertically. var serverlist = blessed.list({ align: "center", mouse: true, width: "50%", height: "50%", top: "center", left: "center", items: [ "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" ] }); // append our box screen. screen.append(serverlist); serverlist.select(0); // quit on escape, q, or control-c. screen.key(["escape", "q", "c-c"], function(ch, key) { homecoming process.exit(0); }); // focus our element. serverlist.focus(); // render screen. screen.render();
according docs , chjj/blessed/test/widget.js
should need. errors out saying can't read hight. here error.
typeerror: cannot read property 'height' of null @ scrollablebox.element._gettop (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:2595:17) @ scrollablebox.element._getbottom.parent [as top] (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:2617:15) @ box.element._gettop (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:2613:17) @ box.element._getbottom.parent [as top] (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:2617:15) @ screen._focus (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:1439:19) @ screen.focuspush (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:1389:8) @ screen.clearregion [as focused] (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:1467:15) @ scrollablebox.node.insert (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:86:25) @ scrollablebox.node.append (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:95:8) @ scrollablebox.list.add.list.additem.list.appenditem (/home/giodamelio/projects/real/vindinium-bots/node_modules/blessed/lib/widget.js:4262:8)
it looks bug in blessed
. if manually specify parent: screen
in blessed.list()
options, work. reason it's not automatically determining parent.
the reason test linked works because there other widgets added screen first, means list have parent
set (to added widget).
javascript node.js shell
Comments
Post a Comment