Comments (6)
This might help you:
In the Widgets that use layout not support children,
style.box.size.width = Scalar.Auto // Uses wantedSize.
style.box.size.height = Scalar.None // Fills the parent.
(TextWidget's wantedSize is size of the text, any other Widgets' is (0,0).)
(If Scalar.Auto is specified and wantedSize is 0, fills the parent.)
In the Widgets that are use layout support children:
style.box.size.width = Scalar.Auto // Uses wantedSize.
style.box.size.height = Scalar.None // Shrink as small as.possible.
(PanelWidget's wantedSize is usually (0,0). So you can expand as big as possible if specify Scalar.Auto.)
The parent means given size.
from w4d.
auto scroll = new VerticalScrollPanelWidget;
scroll.style.box.size.width = 100.pixel;
scroll.style.box.size.height = 100.pixel;
addChild( scroll );
auto panel1 = new PanelWidget;
panel1.setLayout!VerticalLineupLayout;
scroll.contents.addChild( panel1 );
foreach ( i; 0..10 ) {
auto panel2 = new PanelWidget;
panel2.setLayout!VerticalMonospacedSplitLayout;
panel1.addChild( panel2 );
auto panel3 = new PanelWidget;
panel3.setLayout!HorizontalLineupLayout;
panel3.style.box.size.height = Scalar.Auto;
panel2.addChild( panel3 );
auto text1 = new TextWidget;
text1.loadText( "hogehogehoge", fontface );
panel3.addChild( text1 );
auto text2 = new TextWidget;
text2.loadText( "fugafugafuga", fontface );
panel3.addChild( text2 );
auto text3 = new TextWidget;
text3.loadText( "piyopiyopiyo", fontface );
text3.style.box.size.height = Scalar.None;
panel2.addChild( text3 );
auto text4 = new TextWidget;
text4.loadText( "fuyofuyofuyo", fontface );
text4.style.box.size.height = Scalar.None;
panel2.addChild( text4 );
}
It worked for me without problem.
from w4d.
And what version are you using? My code worked at e962ca7.
from w4d.
I have the full code on https://gitlab.com/WebFreak001/TTRLauncherLite but when I come home today I will try to make a reproducible test case
from w4d.
https://gitlab.com/WebFreak001/TTRLauncherLite/blob/master/source/widget/root.d#L54
Please replace with VerticalSplitLayout.
LineupLayout gives children a client size of the owner whenever.
But SplitLayout gives them the remained size.
If A's height is 50%, and B's height is 100%:
- By VerticalLineupLayout, sum height of all children will be 150%.
- By VerticalSplitLayout, it will be 100%.
from w4d.
oh yep that fixed it thanks.
Maybe you could add some ddoc to the layouts so it's clear what they all do
from w4d.
Related Issues (9)
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 w4d.