Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Inserting a scrollbar #247

Answered by WhoAteDaCake
WhoAteDaCake asked this question in Q&A
Inserting a scrollbar #247
Jun 12, 2021 * 3 comments * 1 reply
Answered by WhoAteDaCake Return to top
Discussion options

WhoAteDaCake
Jun 12, 2021

Hello, is the any special configuration when creating a scrollbar? From my understanding if my component layout is like:

  • root
    • content
      • item1
      • item2
    • scrollbar

I should run ScrollBar_BindTarget for scrollbar -> content. And Widget_Append content -> root, then scrollbar -> root and it should work. However, I am not seeing the scrollbar in my component. Am I doing something wrong or is there a css property, which needs to be set for this to work?

Edit

  • I tried to set overflow: scroll on content and root, but it still doesn't work.
  • ScrollBar_BindBox doesn't solve it either
You must be logged in to vote

Turns out the issue was because my parent containers did not have height property set correctly, after setting all of them to height: 100%, it worked as expected

View full answer

Replies: 3 comments 1 reply

Comment options

WhoAteDaCake
Jun 12, 2021
Author

Hmm, it might be issue with the bindings I'm creating, even with trying to recreate test_scrollbar.c it's not working

You must be logged in to vote
1 reply
Comment options

WhoAteDaCake Jun 12, 2021
Author

Tried to use LCUIBuilder_LoadFile to avoid any changes, yet oddly enough, it displays the horizontal bar correctly, but not the vertical one

Comment options

lc-soft
Jun 13, 2021
Maintainer

However, I am not seeing the scrollbar in my component.

The scrollbar is displayed when the content size exceeds the container size.

If you want to always display the scroll bar, we need to modify the source code of the scroll bar, add a property to express always display the scroll bar, and then modify the if statement here.

if (n < 1.0) {
Widget_Show(w);
if (scrollbar->direction == LCUI_SCROLLBAR_HORIZONTAL) {
Widget_AddClass(scrollbar->box,
"has-horizontal-scrollbar");
} else {
Widget_AddClass(scrollbar->box,
"has-vertical-scrollbar");
}
} else {

I tried to set overflow: scroll on content and root, but it still doesn't work.

You must be logged in to vote
0 replies
Comment options

WhoAteDaCake
Jun 25, 2021
Author

Turns out the issue was because my parent containers did not have height property set correctly, after setting all of them to height: 100%, it worked as expected

You must be logged in to vote
0 replies
Answer selected by WhoAteDaCake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants