B4A Library [Class] Multi Type SlidingPanels

erfan

Member
Licensed User
Longtime User
thanks man

no. i just tried "[Class]SlidingPanels "

now i tried with activity touch and it works find

thanks
 
Last edited:

CapReed

Member
Licensed User
Longtime User
Hi all,

I have a problem that has caused me to lose much time today along :BangHead:

Suppose I'm on the panel number 0, and I want to commute to the panel number three, WITHOUT PASSING panel number 1 and number 2 panel.

Could you tell me which modification needs to be done in class to avoid receiving the intermediate panels? That is, you can go directly from the panel 0 to 3 without intermediate transitions for panels 2 and 3.

Thank you very much for this great example.

(excuse my bad english ...)



UPDATE!!!
I finally managed to solve it. The solution is in the SUB:


Thank you for all!
 
Last edited:

me68

Member
Licensed User
Longtime User
Hello Dominex!

I use your SlidingPanels in our app and it is a famous feeling scrolling trough the panels - thanks! We have 11 panels in the meantime.



Now i added a panel as cockpit view of the car (an ev-car Citroen C-Zero/Peugeot iOn/Mitsubishi i-MiEV).



Now i want to maximize this panel to full screen by double click. If maximized the way back should be another double click.

Is this possible and how?


Martin
 

Dominex

Active Member
Licensed User
Longtime User
Well, I'm glad you solved your problem.
 

me68

Member
Licensed User
Longtime User
Hello Dominex!

I solved it by myself in the meantime.

I made a Sub MaximizeRestorePanels

B4X:
Private Sub MaximizeRestorePanels
    Dim j As Int
    Dim iWidthTemp As Int
    Dim iWidthDelta As Int
   
    If Display.Width = GetDeviceLayoutValues.Width Then
        vWidth = iWidth
        vHeight = iHeight
 
        Display.Left = iLeft
        Display.Top = iTop
        Display.Width = iWidth
        Display.Height = iHeight
       
        For j = 0 To Panels.Length - 1
            Panels(j).width = vWidth
            Panels(j).height = vHeight
            Panels(j).GetView(0).Width = vWidth
            Panels(j).GetView(0).height = vHeight
            Panels(j).GetView(0).Invalidate
            If Panels(j).GetView(0).tag = "Pnl_Cockpit" Then
                Panels(j).GetView(0).top = 0
                CallSub2(Main, "UpdatePanelCockpit", True)
                CallSub2(Main, "UpdatePanelTripTimer", True)
            End If
        Next
        'Display.Invalidate
        'Panels(CurrentPanel).GetView(0).Invalidate
    Else
        vWidth = GetDeviceLayoutValues.Width
        vHeight = GetDeviceLayoutValues.Height
 
        iLeft = Display.Left
        iTop = Display.top
        iWidth = Display.Width
        iHeight = Display.Height
 
        Display.Left = 0
        Display.top = 0
        Display.Width = vWidth
        Display.Height = vHeight
        Display.BringToFront
 
        For j = 0 To Panels.Length - 1
            Panels(j).width = vWidth
            Panels(j).height = vHeight
           
            Panels(j).GetView(0).Width = vWidth
            Panels(j).GetView(0).height = vHeight
            Panels(j).GetView(0).Invalidate
            If Panels(j).GetView(0).tag = "Pnl_Cockpit" Then
                iWidthTemp = vHeight * iWidth / iHeight
                iWidthDelta = vWidth - iWidthTemp
               
                Panels(j).GetView(0).Height = Panels(j).GetView(0).Height + iWidthDelta
                Panels(j).GetView(0).top = - iWidthDelta / 2
               
                CallSub2(Main, "UpdatePanelCockpit", True)
                CallSub2(Main, "UpdatePanelTripTimer", True)
            End If
        Next
        'Display.Invalidate
        'Panels(CurrentPanel).GetView(0).Invalidate
    End If
End Sub

And i use a second timer for DoubleClick time

B4X:
Case ACTION_UP
        tsClick1 = DateTime.Now
        If tsClick1 - tsClick2 < cTimeDoubleClick Then
            DoubleClick = True
            LongClick = False
            TimerLC.Enabled = False
            MaximizeRestorePanels
            PanelToCentre(CurrentPanel,Velocity * 10)
           
            If SubExists(vModule,vEventName&"_DoubleClick") Then
                vTouchData.Tag = Panels(Touched).Tag
                CallSub2(vModule,vEventName&"_DoubleClick",vTouchData)
            End If
            Return
        End If
        tsClick2 = tsClick1

Thank you for sharing your source!


Martin
 

JMB

Active Member
Licensed User
Longtime User
Hi there,

Probably being stupid, but couldn't get the files to work - when I try to run match demo, it can't find any of your portaxx.jpg files.

JMB
 

Dominex

Active Member
Licensed User
Longtime User
Hi there,

Probably being stupid, but couldn't get the files to work - when I try to run match demo, it can't find any of your portaxx.jpg files.

JMB
Hi,

you must excuse me, it's my fault, in the last update missing the images.

Redownload the file.
 

DonManfred

Expert
Licensed User
Longtime User
Hello @Dominex
i just found your library... REALLY NICE. Thanx fo sharing!

I have a little problem with it....

the SD (Dim SD As SlidingPanels) is put on a panel which is part of a layout.
I have created two CustomListViews by code created and i´m using them

B4X:
SD.Initialize("SD",300,PanelMain,Me,False) 'Initialize the Class.
clvalbum.Initialize(Me,"clvAlbum")
clvvideos.Initialize(Me,"clvVideos")
'[..]
SD.ModeFullScreen(3,True) 'Creates the mode of SlidingPanels.
'---Add elements to Panels---
Dim c As Int
For c = 0 To maxPnl-1
SD.panels(c).Color = Colors.RGB(Rnd(0,256),Rnd(0,256),Rnd(0,256))
SD.panels(c).RemoveAllViews
If c = 0 Then
    SD.Panels(c).LoadLayout("panelclv")
    clvalbum = clv1 ' clv1 is in panelclv
    clvalbum.AsView.Color = Colors.RGB(Rnd(0,256),Rnd(0,256),Rnd(0,256))
End If
If c = 1 Then
    SD.Panels(c).LoadLayout("panelclv")
    clvvideos = clv1
    clvvideos.AsView.Color = Colors.RGB(Rnd(0,256),Rnd(0,256),Rnd(0,256))
End If

It works so far. I can see all i wanted to see. All click-events are fired... I also can jump to an other panel (in this case i have 0 and 1) with
B4X:
SD.JumpToPanel(1, 300, 100)

BUT i cannot swipe the thing with my fingers....

I think it´s cause i´m loading a layout onto the panel?

How can i get this to work?

Any useful tips are badly appreciated
 

rafaelbr20

Member
Licensed User
Longtime User
Hi Dominex !!
Very nice library !! Very useful !

I´m having a problem because i added 2 imagens on each panel, and when the finger goes on top the image and try to slide it fails , but when the finger goes on top of the panel it goes well !

I tried to send panels to front, back, and images to front and back but didin´t work!

I would like the panels slide right when i click anywhere !!

I identified that when I take the click event of the image it works, i think i has some conflict between Touch_Activity and img_Click.

Do you have any idea to help me ?

Thanks so much !

Rafael
 

Attachments

  • Screenshot_2014-04-12-12-28-57.png
    154.7 KB · Views: 292
Last edited:

rafaelbr20

Member
Licensed User
Longtime User
He used the version TouchActivity?
Thanks for your reply !

Yes, i Did ! See code bellow !

B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim SD As SlidingPanels
Private imgFundoMar As ImageView
    Private imgFazenda As ImageView
    Private imgQuiz As ImageView
    Private imgPuzzle As ImageView

SD.Initialize("SD",300,Activity,Me,True) 'Initialize the Class.
SD.ModeLittlePanels(2,100%x,65%y,Activity.Height/6*4,0dip,False) 'Creates the mode of SlidingPanels.
SD.panels(0).Color = Colors.ARGB(45,255,255,255)
SD.panels(1).Color = Colors.ARGB(45,255,255,255)

SD.panels(0).AddView(imgFundoMar,20%x,0dip,larguraBotoesInicial,alturaBotoesInicial)
SD.panels(0).AddView(imgFazenda,60%x,0dip,larguraBotoesInicial,alturaBotoesInicial)
SD.panels(1).AddView(imgQuiz, 20%x,0dip,larguraBotoesInicial,alturaBotoesInicial)
SD.panels(1).AddView(imgPuzzle,60%x,0dip,larguraBotoesInicial,alturaBotoesInicial)

SD.Start(0) 'Start the SlidingPanels.
SD.Panels(0).SendToBack
SD.Panels(1).SendToBack

end Sub

Sub Activity_Touch (Action As Int, X As Float, Y As Float)
    'This line should be added if you use the option ActivityTouch.
    SD.Panels_Touch(Action,X,Y)
End Sub

Sub imgFundoMar_Click
    cliqueBotaoPrincipal("frmFundoMar",imgFundoMar)
End Sub

Sub imgPuzzle_Click
    cliqueBotaoPrincipal("frmquebraCabecas",imgPuzzle)
End Sub

Sub imgQuiz_Click
    cliqueBotaoPrincipal("frmQuizzAnimais",imgQuiz)   
End Sub
Sub imgFazenda_Click
    cliqueBotaoPrincipal("frmFazenda",imgFazenda)
End Sub
 
Last edited:

rafaelbr20

Member
Licensed User
Longtime User
The images on the panel have their own click event?
Because if so the event of the images may take precedence.

Exactly !!! They have their own click event !

So there's nothing can i do ? Raising some event or something like that ?

Thanks again for your help !!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…