B4A Library [Lib] ScrollView2D

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Just tried to upgrade from v1.1 to (v1.2 and v1.3) and now when I try and set the ScrollView2D.Panel <height and width>

Crashes

B4X:
  mGrid_Body_SV2D.Panel.Height = CurOffset  + (mFixedHeight - mGridSpacing) + mGridSize
  mGrid_Body_SV2D.Panel.Width  = CurGridBodyLeft + mGridSize


Error occurred on line: 881 (cGrid)
java.lang.NullPointerException
at anywheresoftware.b4a.objects.ViewWrapper.setHeight(ViewWrapper.java:165)
at com.BOBs.GolfScore.cgrid._showgrid(cgrid.java:739)
at com.BOBs.GolfScore.aplayerscoring._drawscoringscreen(aplayerscoring.java:3967)
at com.BOBs.GolfScore.aplayerscoring._createscreen(aplayerscoring.java:3658)
at com.BOBs.GolfScore.aplayerscoring._precreate(aplayerscoring.java:1031)
at com.BOBs.GolfScore.aplayerscoring._activity_create(aplayerscoring.java:773)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)

If I go back to v1.1 everything is fine.

Can I no longer set the Height and Width in the new versions?
 

boten

Active Member
Licensed User
Longtime User
My ScrollView2D's inner panel has labels stacked one below the other.
Each label is of fixed height (lblhgt).

Scrolling vertically (both by slow finger movement AND by fling) can scroll any amount.

What's the best approach to force scroll "by full label height", that is, when a scroll is done - snap VerticalScrollPosition to a integer multiple of lblhgt?
 

W. Graf

Member
Licensed User
Longtime User
Hi Informatix!

ScrollView2D is really great! I like it.
I only have one Problem: I added a seekbar on a ScrollView2D. The touch-event of the seekbar is captured by ScrollView2D. So I'm Scrolling the 2D-area, but not the seekbar. Only in 1 of 10 tries, I'm able to scroll the seekbar.
Is there a possibility, that ScrollView2D only ignores the touch-event, if I touch the seekbar?

Thank you!
 

W. Graf

Member
Licensed User
Longtime User
Thanks for your QUICK(!) answer!!!

If I call ScrollView2D1.DisableTouchEventInterception(True), then nothing changes.
I put this call into the click-event of a button. Both the button and the seekbar is on the ScrollView and both were scrolled by ScrollView. If I click on the button, the function is called, but I still can scroll the ScrollView2D (and I'm not able to scroll the seekbar).

Btw: This call prevents the scroll generally, right? So I will not be able to scroll at all, right?
 

Informatix

Expert
Licensed User
Longtime User
Ah yes you're right. It's for the ScrollView2d parent, not for the children. The only solution is to call something similar in the seekbar code to prevent ScrollView2D from intercepting the touch event.
 

W. Graf

Member
Licensed User
Longtime User
I'm afraid, that Seekbar doesn't offer such a function.

Ok, then I will have to think about a new GUI-design for my app. Thanks for your Reply.
 

RichardHirst

Member
Licensed User
Longtime User
Hello

Please can you tell me if it is possible to Stop the ScrollView2D from moving with code. I see the Enable but not sure what this does.

I want to draw on the canvas while then ScrollView2D remains static, then be able to pan around the panel (which is larger than the screen) using the scroll events etc.

Thank You

Richard
 

Star-Dust

Expert
Licensed User
Longtime User
@Informatix , Why are you releasing the sources of your libraries?
 

Star-Dust

Expert
Licensed User
Longtime User
 

klaus

Expert
Licensed User
Longtime User
Sorry, I do not understand your question.
ScrollView2D scrolls in both directions.
Of course, if you are on the left edge you can scroll only to the right.
And if you are on the right edge you can scroll only to the left.
Do you have an example showing your problem ?
 

alirezahassan

Active Member
Licensed User
I mean, can the scroll be right when it is created? (If it can be taken with the position code and transferred to a position, it can be fixed.)
In English, scrolling must be done from the left.
In languages like Arabic it must be created from the right.
 

klaus

Expert
Licensed User
Longtime User
The ScrollView2D class has nothing to do with languages.
You can set the horizontal position at the beginning to any position and of course to the most right position with:
ScrollView2D.HorizontalScrollPosition = xxx
 

wdegler

Active Member
Licensed User
Longtime User
Thank you! This is just what I needed.

My next step is to find out why B4A Bridge cannot parse any of my packages. It worked yesterday.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…