Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrollPanelWidget not working properly #8

Closed
WebFreak001 opened this issue Aug 12, 2018 · 6 comments
Closed

ScrollPanelWidget not working properly #8

WebFreak001 opened this issue Aug 12, 2018 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@WebFreak001
Copy link
Contributor

WebFreak001 commented Aug 12, 2018

I have this layout:

VerticalScrollPanelWidget
.contents:
  PanelWidget:VerticalLineupLayout
    PanelWidget:VerticalMonospacesSplitLayout {x10}
      PanelWidget:HorizontalLineupLayout
        TextWidget
        TextWidget
      TextWidget
      TextWidget

the scrollbar doesn't go all the way down if the parent container is not big enough (children are clipped outside). After manually setting the {x10} PanelWidget height to 80px it works for more sizes, but it's still broken.

Am I using the ScrollPanelWidget wrong?

@KanzakiKino KanzakiKino self-assigned this Aug 12, 2018
@KanzakiKino KanzakiKino added the bug Something isn't working label Aug 12, 2018
@KanzakiKino
Copy link
Owner

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.

@KanzakiKino
Copy link
Owner

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.

@KanzakiKino
Copy link
Owner

And what version are you using? My code worked at e962ca7.

@WebFreak001
Copy link
Contributor Author

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

@KanzakiKino
Copy link
Owner

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%.

@WebFreak001
Copy link
Contributor Author

oh yep that fixed it thanks.

Maybe you could add some ddoc to the layouts so it's clear what they all do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants