Comments (9)
Is there a way to place two boxes on a parent box, and put box 2 at the bottom of box 1 even if box 1 has 'shrink' height?
from blessed.
Blessed does not have an auto-position feature. It's very tough to decide exact behavior. Blessed could implement some very primitive auto positioning easy enough, but it wouldn't be anything as complex as the box model positioning in css. It would be more like position: inline
for everything probably. I'll leave this open because it's a feature I've considered for a while.
from blessed.
Hi, Blessed is great stuff!
I was thinking about something similar. Essentially, one could build a "packer" for layouts once the elements been rendered. I saw some note that you build the UI from bottom up, children first. I really like the "shrink: true" option, that seems to do some autosizing of basic widgets. However, there is no "packer" widget/container. I was looking at what would be needed for this, but was not able to ascertain the size of any UI element even after it's been rendered.
I made three checkboxes, rendered in various sizes and content and positions
(changed test/widget-form.js)
var i = 3;
function makeRadio(name) {
var radio1 = blessed.radiobutton({
parent: form,
mouse: true,
keys: true,
shrink: true,
style: {
bg: 'white'
},
height: i-2,
left: i-3,
top: (i++)*3-6,
name: name,
content: name,
});
return radio1;
}
var x = makeRadio('AAAA');
var y = makeRadio('BBBBB');
var z = makeRadio('CCCCCC');
top, bottom, width,height, left, right, content
3, 37, 91, 1 0, 0 "AAAA"
6, 33, 90, 2 1, 0 "BBBBB"
9, 29, 89, 3 2, 0 "CCCCCC"
I cannot interpret the values, the bigger widget have smaller values, none of them related to actual width size, length. The only values that makes sense are "top" and "left".
I've read the docs and it says some values are calculated but I can't interpret them.
Source code reading next I guess!
from blessed.
I'm not sure what your question is. Without seeing the dimensions and position of form
, I can't tell you if those values are correct or not. Could you explain more?
from blessed.
cc @secrettriangle, @yaronn, @mscdex
I whipped up a Layout
element last night when I couldn't sleep. The first real auto-positioning feature for blessed. It's very dynamic: anyone can provide their own positioning callback. The default positions elements similar to inline-block.
- https://github.com/chjj/blessed#layout-from-element
- https://github.com/chjj/blessed/blob/master/lib/widgets/layout.js
Thoughts?
from blessed.
Definitely think we need something like this. Doing something kind of silly here so maybe this will make it cleaner. I'll try it out soon.
from blessed.
I'm thinking of dropping the Layout element and just adding the renderer
option to all elements, along with builtin layout
options: grid
, and inline
.
from blessed.
That last commit sort of perfects grid
vs. inline
.
from blessed.
Hello, what about a paragraph that takes one line on desktop but two on mobile ? The next element below won't automatically preserve the padding. Thanks
from blessed.
Related Issues (20)
- Windows Command Line cannot display some fg colors
- is there a way to find out if there is an element underneath the mouse
- [docs]: Wrap all sections in `details` tags
- box cannot be aligned to any location
- Archive project? HOT 17
- Emojis break boxes [bug] HOT 7
- Mouse events not detected in windows HOT 2
- deno support? HOT 5
- How to set box exact height and width? HOT 1
- Overlay Image Disappears when Input focused
- text align
- How do you update the style of an existing element?
- get current screen text
- Doubling of characters on Textbox HOT 2
- Split terminal view in two-page layout
- Feature request
- Documentation is difficult to navigate
- click events not registering in warp
- Can't create a new Screen after destroying the first one
- I'm curious as to why has this project stoped?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blessed.