B4A Library TablePanel - Adds swipe navigation to B4XTable

Discussion in 'Additional libraries, classes and official updates' started by Erel, Apr 8, 2019.

  1. Erel

    Erel Administrator Staff Member Licensed User

    With TablePanel class, the user can switch pages by swiping right or left over the bottom of the table.

    Usage:

    Initialize TablePanel and load the layout to TablePanel instead of the activity:
    Code:
    tp.Initialize(Me, "tp"Activity)
    tp.base.LoadLayout(
    "1")
    Handle the swipe event:
    Code:
    Sub tp_Swipe (DeltaX As Float, DeltaY As Float)
       
    If DeltaX < 0 And btnNext.Enabled Then btnNext_Click
       
    If DeltaX > 0 And btnPrev.Enabled Then btnPrev_Click
    End Sub
    Depends on ViewsEx v1.30+.
     

    Attached Files:

  2. Mahares

    Mahares Well Known Member Licensed User

    For what it is worth, I have replaced this line in Tablepanel class module:
    Code:
    If dx > 5dip And TouchYStart >  0.7 * base.Height
    With the below line to have the full screen as a swipe area as opposed to only the bottom 30% of the screen:
    Code:
    If dx > 5dip And TouchYStart >  0 Then  'you can swipe anywhwere on the screen
    Is there a way to use the Activity.Title area for a swipe instead of the activity itself, in order to avoid clicking accidentally on a cell when trying to swipe?
    Thank you
    '
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    The downside is that the user will not be able to horizontally scroll the columns.

    You can reduce dx > 5dip to make it more sensitive. I don't see how you can detect swipes over the action bar, it will also be difficult for the user to do. It is more convenient to swipe over the bottom of the screen.
     
  4. Alexis Martial

    Alexis Martial Member Licensed User

    Works nice, thanks !

    However, would be better if:
    - the TouchPanelCreator cover exactly the BXTable except the header
    - the TablePanel sized to the BXTable, so will not interact with other part of the layout

    After I got my app in alpha version up and running I will try to work out something.

    Thanks again.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice