B4A Library Scrolling Panel

Here is a scrolling panel which can auto scroll objects and text contained smoothly in both directions right-to-left and left-to right

the library allows the developer to switch the direction while playing, it also rearrange the views contained to match the scrolling direction

you can also add or remove views during the playback, think about it as the luggage roller line, some people add luggage and other people removes their luggage while the roller is scrolling

this is good for rss news display.

amfYLA_LtCGj2bgF8PJgv-xRizYmBUL44oW6-RtQ4L_GmeudkOSAsVW_OdLOxKM4dGod5-uhWct9aeznICRS66rHRoqXnzN4d0FR=w1920-h1045



to use the library you can add ScrollingPanel from designer customView

B4X:
    ScrollingPanel1.SetDirection(ScrollingPanel1.DIRECTION_RIGHT)
 
    ScrollingPanel1.AddText("text1","1",Colors.Blue,200, Gravity.CENTER_VERTICAL    )
    ScrollingPanel1.AddText("text2","2",Colors.Green,50, Gravity.TOP)
    ScrollingPanel1.AddText("text3","3",Colors.Red,50, Gravity.BOTTOM)
    ScrollingPanel1.AddText("All good things come to an end: Japan's benchmark just finished its longest ever win streak","4",Colors.White,60, Gravity.CENTER_VERTICAL)
 
    Dim nbutton As Button
    nbutton.Initialize("")
    nbutton.Text = "This is a button"
 
    'Activity.AddView(ScrollingPanel1,0,0,1,1)
 
 
    ScrollingPanel1.AddObjectToPanel(nbutton,300,50,"Button1")

    ScrollingPanel1.StartScrolling(50000)
    Sleep(20000)
    ScrollingPanel1.RemoveObject("3")
    Sleep(15000)
    ScrollingPanel1.RemoveObject("1")
 

Attachments

  • Scrolling Text Source and example.zip
    44.8 KB · Views: 408
  • ScrollingPanel.zip
    5.7 KB · Views: 421
Last edited:

NJDude

Expert
Licensed User
Longtime User
Very nice, but I'm having a problem running the example, the app crashes on this line:
B4X:
	For Each item In ObjectsCollection.Keys
That's line #153 in the ScrollingPanel class.

These are the logs:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 153 (ScrollingPanel)
java.lang.RuntimeException: Object should first be initialized (Map).
	at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
	at anywheresoftware.b4a.objects.collections.Map.getSize(Map.java:110)
	at anywheresoftware.b4a.objects.collections.Map$1.getSize(Map.java:138)
	at fast.scroll.scrollingpanel._addobjecttopanel(scrollingpanel.java:149)
	at fast.scroll.scrollingpanel._addtext(scrollingpanel.java:111)
	at java.lang.reflect.Method.invoke(Native Method)
	at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
	at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
	at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
	at java.lang.reflect.Method.invoke(Native Method)
	at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
	at fast.scroll.main.afterFirstLayout(main.java:102)
	at fast.scroll.main.access$000(main.java:17)
	at fast.scroll.main$WaitForLayout.run(main.java:80)
	at android.os.Handler.handleCallback(Handler.java:751)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:154)
	at android.app.ActivityThread.main(ActivityThread.java:6121)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
** Activity (main) Resume **
Am I missing something?
 

Asim A Baki

Active Member
Licensed User
Longtime User
Very nice, but I'm having a problem running the example, the app crashes on this line:
B4X:
    For Each item In ObjectsCollection.Keys
That's line #153 in the ScrollingPanel class.

These are the logs:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 153 (ScrollingPanel)
java.lang.RuntimeException: Object should first be initialized (Map).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
    at anywheresoftware.b4a.objects.collections.Map.getSize(Map.java:110)
    at anywheresoftware.b4a.objects.collections.Map$1.getSize(Map.java:138)
    at fast.scroll.scrollingpanel._addobjecttopanel(scrollingpanel.java:149)
    at fast.scroll.scrollingpanel._addtext(scrollingpanel.java:111)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
    at fast.scroll.main.afterFirstLayout(main.java:102)
    at fast.scroll.main.access$000(main.java:17)
    at fast.scroll.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6121)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
** Activity (main) Resume **
Am I missing something?
Sorry My BAD, I was missing the initialization in the class initiator, I have replaced the main post attachments now with the working ones
 

Jamesson

Member
Hello! Thanks for contribute with us. My compilation return a error of missing library reference. How can I fix it? Can u help me?


ScrollingPanel - 99: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 95: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 93: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 92: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 91: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 90: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 89: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 88: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 85: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 83: Undeclared variable 'animator' is used before it was assigned any value.
ScrollingPanel - 30: Unknown type: animationplus<br />Are you missing a library reference?
 

Jamesson

Member
You should use TabStripViewPager.
Hello. I'm using it. Forgive my ignorance 'cause I'm a beginner. Asim A Baker posted this example and attached another zip file with a xml and .jar. Need I put this files where?
 

Attachments

  • animationplus não funciona.png
    animationplus não funciona.png
    116.5 KB · Views: 227

mcqueccu

Well-Known Member
Licensed User
Longtime User
Hello. I'm using it. Forgive my ignorance 'cause I'm a beginner. Asim A Baker posted this example and attached another zip file with a xml and .jar. Need I put this files where?


Any Library you download, the jar and the xml goes to the additional libraries folder.
 
Top