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: 2,691
  • 4.png
    4.png
    16.9 KB · Views: 2,830
  • SD_PanelExtra 0.11.zip
    28.6 KB · Views: 1,323
Last edited:

Star-Dust

Expert
Licensed User
Longtime 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
 

Attachments

  • SamplePanelNav.zip
    25.6 KB · Views: 1,028
  • ScrollTitle.zip
    10 KB · Views: 835
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Update to 0.02
It can make Visible Label with the name of the panel
  • seticonpanelvisible (Visible As Boolean) As String
    Make visible or Invisible Label Name of panel
  • setNamepanelVisible (Visible As Boolean) As String
    Make visible or Invisible icon of panel
  • SetTextColorNamePanel(Color As Int)
    Set a texto Color of Name Panel if visible
Add new metod
    • addAt (Name As String, Color As Int, Icon As BitmapWrapper, Position As Int) As String
      Now accept icon null
AddAt: Insert a new panel to a specific position

Update to 0.03

1) Add new metod to PanelNavigator (return a panel added)
add2 (Name As String, Color As Int, Icon As BitmapWrapper) As Panel
SetNamePanelVisible (Visible As Boolean) As String
SetIcon (Index As Int, B As Bitmap) As String

2) Insert TitleScrollView Panel

Update to 0.04
FIX BUG TitleScroll
You can scroll through the center panel and as you can see lower the title panel in smaller dimensions and turn into another smaller panel

Update to 0.05
Add SlidePanel
You can open a side panel (right, left, top, bottom) just by dragging your finger from the edge and you'll see the panel
 
Last edited:

davelew1s

Active Member
Licensed User
Longtime User
Hi
Star-Dust
I have downloaded the libs and example it seems to work ok. I have played around adding other views witout any problems.
The only thing I get is this error:-
"ERROR.LoadDrawableByName:android.content.res.Resources$NotFoundException: Resource ID #0x0"
it occures on this line:-
' PanelNavigator1.Add(i,Color(i),LoadBitmap(File.DirAssets,(i+1) & ".png"))'
it doesn't seem to cause any problems but I cannot find the cause and a solution ... any idea's?
Thanks for your work I will find it very useful.
Dave.
 

Star-Dust

Expert
Licensed User
Longtime User
Hi
Star-Dust
I have downloaded the libs and example it seems to work ok. I have played around adding other views witout any problems.
The only thing I get is this error:-
"ERROR.LoadDrawableByName:android.content.res.Resources$NotFoundException: Resource ID #0x0"
it occures on this line:-
' PanelNavigator1.Add(i,Color(i),LoadBitmap(File.DirAssets,(i+1) & ".png"))'
it doesn't seem to cause any problems but I cannot find the cause and a solution ... any idea's?
Thanks for your work I will find it very useful.
Dave.
This error occurs if you change the "NameDrawable" property, default value is "magnified_region_frame"
also: download the latest version of the library
 

Star-Dust

Expert
Licensed User
Longtime User
Update to 0.03

1) Add new metod to PanelNavigator (return a panel added)
add2 (Name As String, Color As Int, Icon As BitmapWrapper) As Panel
SetNamePanelVisible (Visible As Boolean) As String
SetIcon (Index As Int, B As Bitmap) As String
2) Insert TitleScrollView Panel

See Post#1 for Library
See post#3 for Sample
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Update to 0.05
New SlidePanel Class
You can add a side panel that opens by squeezing your finger to the right.
In this panel you can enter a list, a menu or anything else.
SlidePanel slider right / left / top / bottom
B4X:
' SLIDE PANEL
SlidePanel1.GetBase.Elevation=2dip
SlidePanel1.PanelSlide.LoadLayout("List")

Slide1.gif
slide2.gif
 

Attachments

  • Slide2.zip
    24.3 KB · Views: 707
  • slide1.zip
    25.4 KB · Views: 708
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Next Update: SwipePanel, You can close a scroll panel with your finger in a preset direction (right, left, top, bottom)
7.gif
3.gif
Swipe1.gif
 

Attachments

  • Swipe1.zip
    25.4 KB · Views: 729
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
The ManagerPanel Class has been added

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.LoadLayout("main_managerpanel")

    ManagerPanel1.NewPanel("First",1,Colors.RGB(255,216,0),Colors.RGB(127,0,0))
    ManagerPanel1.NewPanel("Second",2,Colors.Yellow,Colors.RGB(107,63,127))
    ManagerPanel1.NewPanel("Third",3,Colors.RGB(127,0,0),Colors.RGB(255,216,0))
    ManagerPanel1.NewPanel("Fourth",4,Colors.Black,Colors.White)
            
    Dim L As Label
    L.Initialize("")
    L.Text="My Label"
    L.TextSize=20
    L.TextColor=Colors.White
            
    ManagerPanel1.getPanel(0).AddView(l,30dip,20dip,100dip,40dip)
    ManagerPanel1.getPanelfromID(1).Color=Colors.ARGB(150,150,150,150)
    
End Sub
' -------------------------------------

Sub ManagerPanel1_Change (FromCode As Boolean, ID As String)
    
    Log(FromCode & "-" & ID)
End Sub

ManagerPanel.gif ManPanOr.gif
 

Attachments

  • sample2.zip
    8.1 KB · Views: 591

Star-Dust

Expert
Licensed User
Longtime User
Update to 0.08 on post#1
Fix bug
 

Carlos marin

Active Member
Licensed User
Longtime User
Update to 0.05
New SlidePanel Class
You can add a side panel that opens by squeezing your finger to the right.
In this panel you can enter a list, a menu or anything else.
SlidePanel slider right / left / top / bottom
B4X:
' SLIDE PANEL
SlidePanel1.GetBase.Elevation=2dip
SlidePanel1.PanelSlide.LoadLayout("List")

View attachment 67834 View attachment 67831

Hi star-dust I have a doubt, when trying to close the panel with your finger, it is positioned where you put your finger and it does not close. It feels as if one is fighting with the panel. Can you deactivate that event so that the panel closes easily with your finger?
 

Star-Dust

Expert
Licensed User
Longtime User
I do not think I understand what you mean
 

Carlos marin

Active Member
Licensed User
Longtime User
I do not think I understand what you mean

hello Star-Dust the truth is that I like this panel very much but I have that problem when using it, sorry for my bad english but it is the same as you comment in the spañol forum (see image).
 

Attachments

  • spanish forum.png
    spanish forum.png
    188.7 KB · Views: 379

Star-Dust

Expert
Licensed User
Longtime User
Now I remember your question, Unfortunately I do not understand English well either.

Does it vibrate when you touch the panel to get it back?
Have you tried to click on the outside of the panel? because so it should be closed automatically
 

Carlos marin

Active Member
Licensed User
Longtime User
Now I remember your question, Unfortunately I do not understand English well either.

Does it vibrate when you touch the panel to get it back?
Have you tried to click on the outside of the panel? because so it should be closed automatically
hello again and thanks for replying. when you want to close the panel by sliding the screen, it does not close. the panel opens up to where you touch the screen. What I wanted was to deactivate that event to simply close the panel by sliding the screen
 

Star-Dust

Expert
Licensed User
Longtime User
The behavior is correct because the idea is just that, that the panel follows the finger. Even if you can open the panel you can drag it.

Exceptionally to facilitate you I added (rel 0.10) a new property: CloseAutomatically Boolean type.
Setting it to true if the panel is open will automatically close if you touch the edge of the panel and do not follow your finger.

But do not get used to asking for new features :p
 
Top