B4J Question [SOLVED] Styled CLV with Stub Scrolls Despite Not Needing To--Possible Issue with AddStubToCLVIfNeeded

cklester

Well-Known Member
Licensed User
In the thread, Styling A CLV Used As A Button List, we styled a CLV to act as a vertical dashboard of buttons. Works great!

One minor issue remains: If you scroll the CLV with the mouse wheel, it moves (seems to be up to 6 pixels).

(Without the fixes in the prior thread--I suspect primarily the XUIViewsUtils.AddStubToCLVIfNeeded--the CLV does not move when the mouse wheel is scrolled.)

Is there a way to fix this so the styled CLV with the stub is not scrollable at all?

Project is attached.
 

Attachments

  • clv_style_scroll_issue.zip
    24.7 KB · Views: 127

Erel

B4X founder
Staff member
Licensed User
Longtime User
Wrong:
B4X:
clv_MenuButtons.sv.Color = fx.Colors.To32Bit(fx.Colors.transparent)
Correct:
B4X:
clv_MenuButtons.sv.Color = XUI.Colors_Transparent

If you check the code in AddStuchToCLVIfNeeded, you will see that it adds 5 pixels to the height in B4J. It is done to ensure that the content is long enough to show the scrollbars. In your it is not needed as the scrollbars are hidden anyway.

You can remove this with:
B4X:
Dim LastIndex As Int = clv_MenuButtons.Size - 1
clv_MenuButtons.ResizeItem(LastIndex, clv_MenuButtons.GetPanel(LastIndex).Height - 6)

Another option, which is actually better, is to make the list transparent. This requires a small CSV file: https://www.b4x.com/android/forum/t...d-and-scrollbar-visibility.101740/post-638776
 
Upvote 0

cklester

Well-Known Member
Licensed User
Another option, which is actually better, is to make the list transparent. This requires a small CSV file...

I tried putting
B4X:
.scroll-pane{
   -fx-background-color:transparent;
}
.scroll-pane .viewport {
   -fx-background-color: transparent;
}

into the "Extra CSS" property of the "Background Properties" of the CLV, but that doesn't seem to work. Should it work that way, or is the file method required?

I think I figured out why it's not working... And this will require the file method.

It is working for me now with the CSS file. Thank you!
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…