B4A Library SD: Panel Extra (Slide Swap Scroll)

Carlos marin

Active Member
Licensed User
Longtime User
hi Star-Dust it is possible that each lower button can load a different activity. the problem is that the whole code becomes very extensive
 

Star-Dust

Expert
Licensed User
Longtime User
hi Star-Dust it is possible that each lower button can load a different activity. the problem is that the whole code becomes very extensive
You can make each button make a panel visible or start a specific activity. You can make it with the Library as it is, it doesn't need to be modified.

I can't make you an example right now, I'm too busy, but you can do it by yourself.
 

Carlos marin

Active Member
Licensed User
Longtime User
You can make each button make a panel visible or start a specific activity. You can make it with the Library as it is, it doesn't need to be modified.

I can't make you an example right now, I'm too busy, but you can do it by yourself.

I have worked with panels and loaded activities on them, but I do not know if it is possible to work the slide swap in different activities so I would not have all the code in one activity
 

Star-Dust

Expert
Licensed User
Longtime User
you can divide the code into classes or into custom views. but I don't know the App so I can't give you specific advice
 

SMOOTSARA

Active Member
Licensed User
Longtime User



hi Star-Dust ?

How do I add "PanelNavigator" to a "ScrollView"?

I want to add "PanelNavigator" to the "ScrollView" as a Custom View (without the use of layout in designer)

B4X:
Sub Activity_Create(FirstTime As Boolean)
    
    Dim ScrollView_master As ScrollView
    ScrollView_master.Initialize(200%y)
    ScrollView_master.Color=Colors.Red
    ScrollView_master.Panel.Color=Colors.DarkGray
    
    Activity.AddView(ScrollView_master,2%x,2%y,96%x,96%y)   
    
''''    ScrollView_master.panel.LoadLayout("panelMain")

    Private PanelNavigator1 As PanelNavigator
    PanelNavigator1.Initialize(Me,"PanelNavigator1")
    ScrollView_master.panel.AddView(PanelNavigator1.GetBase,0,0,80%x,40%y)

    
    For i=0 To 50
        PanelNavigator1.Add(i,Colors.ARGB(255,Rnd(0,255),Rnd(0,255),Rnd(0,255)),Null)
        PanelNavigator1.SetIconPanelVisible(False)
    Next


End Sub

but error is:

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 39 (Main)
java.lang.RuntimeException: Object should first be initialized (Panel).
Did you forget to call Activity.LoadLayout?
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
    at b4a.example.main._activity_create(main.java:408)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at b4a.example.main.afterFirstLayout(main.java:104)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6680)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
** Activity (main) Resume **


thanks
 

DonManfred

Expert
Licensed User
Longtime User
without the use of layout in designer
The correct way of adding a customview is by using the Designer.
You can create a single layout with the customtype and load the layout to the scrollview whenever you need one.

Away from that it is suggested to us xCLV as it is a ScrollView with eXtended Features.
 

Star-Dust

Expert
Licensed User
Longtime User
Actually putting a PanelNavigator inside a scroll View is a strange and difficult solution to manage. Think only of the management of Event raised. They will all be absorbed by PanelNavigator and ScrollView would not function properly.

Having said that, as @DonManfred has told you, you must create a Layout to design and insert a PanelNavigator inside a Panel. You can insert this panel in ScrollView.

Or you have to initialize PanelNavigator and call DesignerCreateView, so that mBase is generated, otherwise it is not initialized and generates that error.

PanelNavigator is designed to be hooked on Activity, I suggest you think of a better solution for this type of view you want to achieve
 
Last edited:

Zlgo

Member
Hi!
I just try your SlidingDemo and at beginning is Messageshow with "Demo remaining x days" , so is this limited library?
 

Star-Dust

Expert
Licensed User
Longtime User
Hi!
I just try your SlidingDemo and at beginning is Messageshow with "Demo remaining x days" , so is this limited library?
Hi,
This library is in a limited version, some classes will only run one week to allow testing. You can receive the full version by making a donation.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…