B4A Library SD: Panel Extra (Slide Swap Scroll)

(No WRAP, No Java Only B4A)

The PanelExtra library contains these classes
PanelNavigator (Example)

1.png 2.gif
SlidePanel (Example)
slide2.gif Slide1.gif
TitleScrollView (Example)
3.gif
SwipePanel (Example)
Swipe1.gif
ManagerPanel (Example)
ManagerPanel.gif

SD_PanelExtra

Author:
Star-Dust
Version: 0.11
  • PanelNavigator
    • Events:
      • ChangePanel (NumberPanel As Int)
    • Fields:
      • BallSize As Int
      • NameDrawable As String
    • Functions:
      • Add (Name As String, Color As Int, Icon As Bitmap) As Int
        Add Name Panel, Color panel, Icon and return index of panel
      • Add2 (Name As String, Color As Int, Icon As Bitmap) As Panel
        Add Name Panel, Color panel, Icon and return panel
      • AddAt (Name As String, Color As Int, Icon As Bitmap, Index As Int) As String
        Add Name Panel, Color panel, Icon at specific position
      • AddMyPanel (Index As Int, Panel As Panel) As String
        PanelNavigator.AddMyPanel(0,Panel3)
      • Class_Globals As String
      • Clear As String
        Remove all panel
      • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
      • GetBase As Panel
      • GetPanel (Index As Int) As Panel
        Get Panel at Index
      • GetPanelName (Index As Int) As String
        Get Name of Panel
      • GetSelectPanel As Int
        Get Panel to be Visible
      • GetVisible As Boolean
      • Initialize (vCallback As Object, vEventName As String) As String
      • Invalidate As String
        Rewrite all design
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • SetBackGroundColor (Color As Int) As String
        Change color of background
      • SetIcon (Index As Int, B As Bitmap) As String
        Set Icon at panel position
      • SetIconPanelVisible (Visible As Boolean) As String
        Set Visible/Invisible Icon Panel
      • SetLayout (Left As Int, Top As Int, Width As Int, Height As Long) As String
      • SetNamePanelVisible (Visible As Boolean) As String
        Set Visible/Invisible Label with NamePanel
      • setPadding (Left As Int, Top As Int, Right As Int, Bottom As Int) As String
      • SetPanelName (Index As Int, Name As String) As String
        Set Name of Panel
      • SetSelectPanel (Index As Int) As String
        Set Panel to be Visible
      • SetTextColorNamePanel (Color As Int) As String
        Set text Color ofa Name Panel if visible
      • SetVisible (Visible As Boolean) As String
      • Size As Int
        Number of panel insert
  • SlidePanel ' Slide Up/Down/Left/Right
    • Events:
      • Close (FromCode As Boolean)
      • Open (FromCode As Boolean)
    • Fields:
      • PanelSlide As Panel
      • SlidePanelAnchor As Int
      • CloseAutomatically As Boolean
      • IsOpen As Boolean
    • Functions:
      • Class_Globals As String
      • CloseSlidePanel As String
      • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
      • GetBase As Panel
      • Initialize (vCallback As Object, vEventName As String) As String
      • Invalidate As String
      • IsInitialized As Boolean
      • OpenSlidePanel As String
      • SetSlideLeft As String
      • SetSlideRight As String
      • SetSlideUp As String
      • SetSlideDown As String
    • Properties:
      • SlidePanelWidth As Int
      • SlidePanelHeight As Int
  • TitleScrollView
    • Fields:
      • FullHeight As Int
      • MyTitleFull As Panel
      • MyTitleReduced As Panel
      • ReduceHeight As Int
      • Scroll As Panel
    • Functions:
      • AddTitleFull (Panel As Panel) As String
      • AddTitleReduce (Panel As Panel) As String
      • Class_Globals As String
      • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
      • GetBase As Panel
      • Initialize (vCallback As Object, vEventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
    • ManagerPanel
      • Events:
        • Change (FromCode As Boolean, ID As String)
      • Functions:
        • Class_Globals As String
        • Clear As String
        • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
        • GetBase As Panel
        • getPanel (Position As Int) As Panel
        • getPanelfromID (ID As String) As Panel
        • getPanelOnScreen As Int
        • Initialize (vCallback As Object, vEventName As String) As String
        • Invalidate As String
        • IsInitialized As Boolean
          Verifica se l'oggetto sia stato inizializzato.
        • NewPanel (Title As String, ID As String, ColorTitle As Int, ColorPanel As Int) As Panel
        • setPanelOnScreen (Position As Int) As String
      • Properties:
        • PanelOnScreen As Int
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. Contact me in private.

For other panel libraries see also this thread

1.gif 2.gif 3.gif
 

Attachments

  • 5.gif
    5.gif
    81.1 KB · Views: 1,831
  • 4.png
    4.png
    16.9 KB · Views: 1,832
  • SD_PanelExtra 0.11.zip
    28.6 KB · Views: 711
Last edited:

Star-Dust

Expert
Licensed 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
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
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
Example Panel Navigator

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private PanelNavigator1 As PanelNavigator
    Dim Color() As Int = Array As Int(0xffffffff,0xffc1ffbf,0xff009699,0xffcd1515,0xffa786ee)
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("panelMain")

    For i=0 To 4
        PanelNavigator1.Add(i,Color(i),LoadBitmap(File.DirAssets,(i+1) & ".png"))
    Next

    PanelNavigator1.Add("Name 5",Colors.Blue,Null)
    ' Also
    ' PanelNavigator1.Add2("Name 5",Colors.Blue,Null).LoadLayout("mypanel")
    ' Or
    ' Dim I as int = PanelNavigator1.Add("Name 5",Colors.Blue,Null)
     ' PanelNavigator1.GetPanel(I).LoadLayout("mypanel")

    Dim L As Label
    L.Initialize("")
    L.Gravity=Gravity.CENTER
    L.Text="First Panel"
    L.TextColor=Colors.Black
    L.TextSize=20
    ' Find first panel and Add a Label
    PanelNavigator1.GetPanel(0).AddView(L,0,0,100%x,40dip)
End Sub


Example TitleScroll
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
    TitleScrollView1.MyTitleReduced.LoadLayout("reduced")
    TitleScrollView1.MyTitleFull.LoadLayout("full")
    TitleScrollView1.Scroll.Color=Colors.Yellow
    For i= 1 To 30
        Dim Label1 As Label
   
        Label1.Initialize("")
        Label1.Text="Item " & I
        Label1.Textcolor=Colors.Black
   
        TitleScrollView1.Scroll.AddView(Label1,0,(i-1)*40dip,100%x,40dip)
        TitleScrollView1.Scroll.Height=i * 40dip
    Next

End Sub



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
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
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
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
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:
Top