Android Question Moving Panels .... Again.

rfhall50

Member
Licensed User
Longtime User
Have been through so many threads, now absolutely confused. Many older threads refer to new ways. Just don't know which is the newest!
Situation is:
  • Have a layout done in Designer.
  • Width is fine; no problems.
  • Height is much too long to see on screen at one time.
  • I load the layout using ..... Activity.LoadLayout("category_view")
  • Panel appears; everything OK for what I see. Buttons work great.
  • Problem is that I can not get get to the buttons below the view screen.
  • I want to "touch" the screen and move it up or down to get to the other buttons.
  • A VERY SIMPLE example would be very much appreciated.
Thank You.
Bobby
 

DonManfred

Expert
Licensed User
Longtime User
Use a Scrollview or custom list view
 
Upvote 0

rfhall50

Member
Licensed User
Longtime User
Use a Scrollview or custom list view

(I am just about ready to give up! Sorry, had to get that off my chest.)
I did just as Don suggested. I have narrowed it down to as little code as possible. I have 1 forum example that works perfectly. I cut my code down to match the example, and it continues to tell me that in MY code a panel has not been initialized. Identical example code does NOT give the message. Error messages are:

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 13 (Main)
java.lang.RuntimeException: Object should first be initialized (Panel).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.ViewWrapper.getHeight(ViewWrapper.java:143)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at b4a.example.main.afterFirstLayout(main.java:102)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5666)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
** Activity (main) Resume **

MyCode : (Gives Error)
B4X:
Sub Process_Globals
End Sub

Sub Globals
    Dim scvTest As ScrollView
    Dim pnlTest As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Main")
    scvTest.Panel.LoadLayout("category_view")
'    scvTest.Panel.Height = pnlTest.Height
    scvTest.Panel.Height=pnlTest.Height
End Sub
Sub Activity_Resume
   
End Sub

Sample Code : (No Error)
B4X:
Sub Process_Globals
End Sub

Sub Globals
    Dim scvTest As ScrollView
    Dim pnlTest As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Main")
    scvTest.Panel.LoadLayout("ScrollViewLayout")
    scvTest.Panel.Height = pnlTest.Height
End Sub
Sub Activity_Resume

End Sub

I am also including all BAL files. Note that the first "main.bal" is for my code, the second "main.bal" is from the sample. Sorry to have so much here but I am at my wits end!
Thank You.
Bobby
 

Attachments

  • category_view.bal
    27.5 KB · Views: 152
  • main.bal
    1.4 KB · Views: 163
  • main.bal
    1.5 KB · Views: 158
  • scrollviewlayout.bal
    7 KB · Views: 121
Upvote 0

rfhall50

Member
Licensed User
Longtime User
Thank all of you very much. Got it working this AM. Decided to put a stationary panel over the scrolling panel - just loaded 1 panel over the other. Did have one challenge when I first got the scrolling feature working. When I scrolled to the bottom, some of the buttons were missing. I lengthened the button panel so that there was a large blank area at the bottom. It now scrolls down and shows the last button.

Again, thank all of you very much!
Bobby

Maybe one of these days I will be able to help someone else.
 
Upvote 0
Top