Created
August 12, 2013 14:14
-
-
Save johnspackman/6211166 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var blessed = require('blessed'); | |
// Create a screen object. | |
var screen = blessed.screen(); | |
var form = blessed.form({ | |
width: 40, | |
height: 8, | |
border: { | |
type: "line" | |
} | |
}); | |
var cbx1 = new blessed.Checkbox({ | |
width: 20, | |
left: 2, | |
top: 1, | |
text: "Check me 1" | |
}); | |
form.append(cbx1); | |
var cbx2 = new blessed.Checkbox({ | |
width: 20, | |
left: 2, | |
top: 2, | |
text: "Check me 2" | |
}); | |
form.append(cbx2); | |
var input = blessed.Textarea({ | |
height: 2, | |
width: 20, | |
left: 2, | |
top: 4, | |
inputOnFocus: true | |
}); | |
form.append(input); | |
screen.append(form); | |
input.focus(); | |
screen.key('q', function(ch, key) { | |
return process.exit(0); | |
}); | |
screen.key('tab', function(ch, key) { | |
if (!key.shift) { | |
screen.focusNext(); | |
} else { | |
screen.focusPrev(); | |
} | |
screen.render(); | |
}); | |
screen.render(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment