B4A Library [B4X] [XUI] AS ViewPager based on xCustomListView

Alexander Stolte

Expert
Licensed User
Longtime User

Lello1964

Well-Known Member
Licensed User
Longtime User
there isn't SetCurrentIndex2 in ASViewPager,
also i have Pagine.AddPage(PanelServizi,"PaginaServizi")
is string not int
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.25
    • Add Scroll2Value - sets the current index by the value - smooth scrolls to the item
      • from the AddPage and AddPageAt function the "Value" property
      • must be a string to be found
    • Add Scroll2Value2 - sets the current index by the value - jump to the item
 

Lello1964

Well-Known Member
Licensed User
Longtime User
I replaced the B4A TabStripPager library with AsViewPager, because there is the possibility of blocking the side scroll. Unfortunately, I have encountered a problem that I cannot solve. If I move to a page and from code I modify an edittext that is on a page not visible at that moment; at the end of the operations, when I return to the main page, after a few seconds, for no reason, two pages in the middle are displayed, one half contains the edittext that was corrected by the code. I was unable to solve the problem. If I delete the editText editing, everything works fine. I can't change all the code to fix the problem. Has it already happened to anyone?

 

Alexander Stolte

Expert
Licensed User
Longtime User
For such a problem it is probably better to make a new thread and create an example project which shows the problem. Maybe the EditText get a focus and are triggered by Manifest keyboard settings?
 

Lello1964

Well-Known Member
Licensed User
Longtime User
thanks for the reply, but i can't reproduce the problem with an example.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.26
    • Add Designer Property LazyLoading - activates lazy loading
      • Default: False
    • Add Designer Property LazyLoadingExtraSize - How many pages to load in advance
      • Default: 5
    • Add Event LazyLoadingAddContent - Add here your layout or views
Lazy Loading
Lazy Loading can significantly improve the performance of pages with complex items.
Example: Calendar or Scheduler with 500 or more pages (Weeks, Months, Days)

Use:
  • Enable the "Lazy Loading" property in the designer
  • Add the "LazyLoadingAddContent" event to your form
  • Use the "Parent" parameter from the event to add your layout or views to this panel
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Good news about the lazy loading! Will you also modify your calendar to support this? Can be interesting if many, many months have to be shown.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Will you also modify your calendar to support this?
Yes, in the next weeks, currently I use the feature in a not yet released view. And in the calendar some things need to be adjusted to make lazy loading work, but I'm aware that there can be performance issues if there are many events on the calendar, which hopefully can be fixed with this.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.29
    • Add Commit - Triggers the LazyLoadingAddContent event
      • Call this after you have filled the list
    • LazyLoading BugFixes
Commit
B4X:
For i = 0 To 500 -1   
    Dim xpnl As B4XView = xui.CreatePanel("")
    xpnl.SetLayoutAnimated(0,0,0,Root.Width,Root.Height)
    ASViewPager1.AddPage(xpnl,i +1)
Next
    
    Sleep(0)
    ASViewPager1.Commit
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.30
    • Add ResetLazyloadingIndex - when you call "commit" afterwards, it is guaranteed to check if there are empty panels in the lazy loading range, if so, the LazyLoading event is triggered
Example use case
B4X:
xASVP_Horizontal.AddPage(xpnl_background,"")
Sleep(0)
xASVP_Horizontal.ResetLazyloadingIndex
xASVP_Horizontal.Commit
In the example I am dynamically adding more panels after the PageChanged event, the problem is the lazy loading function has already been triggered and would not trigger again as the CurrentIndex has not changed after the add, so the newly added page would not be populated if it were on the next page. If we reset the internal LazyLoading index and then call commit, then it is guaranteed to find the empty newly added page and populate it via the event.

I needed it in the Version 3.0 of the ASCalendarAdvanced View.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.31
    • important resize improvments
    • Add Loading Panel if Base_Resize is calling
    • Add Designer Property LoadingPanelColor
    • Add set IgnoreLazyLoading - If True, the Lazy Loading event is not triggered
    • Add ResetLazyLoadingPanels - Removes all child views from all visible pages
    • LazyLoading Improvments

Now you don't need to be afraid of resizing the window in B4J, it works much better now!
Why the Loading Panel?
Because otherwise you will see other pages, because when resizing the xclv not all panels are adjusted at the same time and this is a workaround to deliver a better user experience.

Version 1.30 is attached in the first post as backup.
 

Blueforcer

Well-Known Member
Licensed User
Longtime User
Is the Carousel function still beta?
when i check it it doesnt change anything in B4A, no infite scrolling
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…