B4J Library [B4x] B4xScrollPage

Scroll between pages of data for any view.

When the page scrolls update the data for the next page and it is scrolled into place.




The attached B4xScrollPage.zip contains a B4XPages project has examples (and full code) for B4j and B4a.

B4i : It should also work with B4i but you will need to copy the layouts, and provide the B4xScrollPage layout for the library.

Vertical and Horizontal scrolling is supported. In the B4j version you can scroll with the mouse wheel when the mouse pointer is over the B4xPlusMinus label.

When you load the project, don't forget to click 'Ctrl + click to sync files: at the top of the MainPage.

Take a few minutes to read the code to understand how it works:

You are required to make two calls to the B4xScrollPage, one to set the layout which can contain any view. And one to tell the B4xScrollPage how many pages are available and set the first page to display.

You also need one sub _SetPageData in which you set the data for the specified page.

There will be a limit on the amount of data that can be held in the view, only in the time required to render it during the scrolling. If it is too large, the scrolling will be slow. If you are using a customlistview with a large amount of data, you will need to implement lazy loading.

Let me know how you get on with it.

Update: 1.1 Library
  • added SetPageNames to allow a named list to be passed rather than a numeric range.
  • added optional layout to designer properties and auto selection of a no button layout if ShowPageControl = False
  • added LoadPage1(Name As String, Direction As Int)
  • added LoadPage2(Index As Int,Direction As Int)
  • added Constants DIRECTION_NEXT and DIRECTION_PREV
Update Example:
  • Added example of saving page data
The optional layout is intended for use f you want to move the B4xPlus and Minus buttons. The new layout MUST contain all of the existing views. If you just want to hide the B4xPlusMinus and add your own control, you can deselect Show Page Control in the designer. The Content pane will then fill the Base pane and you can add your own control in the layout that contains the B4xPageScroll.
 

Attachments

  • B4xScrollPage1-1.zip
    270.6 KB · Views: 279
  • B4xScrollPage.b4xlib
    9.6 KB · Views: 246
Last edited:

stevel05

Expert
Licensed User
Longtime User
Sorry just noticed I screwed up the file copying. Will sort it out and repost.
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
Hopefully the files are now in the correct places. It's my fist time deploying a B4xPages project, something had to go wrong.
 

stevel05

Expert
Licensed User
Longtime User
Updated to V1.1 see first post.
 

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
Hello, thanks for your work.
I get this message. What will it be?
1605459501059.png
 

stevel05

Expert
Licensed User
Longtime User
That'll be my fault :). I added the main page to the B4xlib. Sorry. Download it again now.
 
Top