B4A Library [B4X] [XUI] xCustomListView - cross platform CustomListView

Discussion in 'Additional libraries, classes and official updates' started by Erel, Oct 1, 2017.

Thread Status:
Not open for further replies.
  1. JLS

    JLS Member Licensed User

    That works! :)

    Thank you very much.
     
  2. luke2012

    luke2012 Well-Known Member Licensed User

    The attached project is a B4A project. To run xCustomListView on iOS device I can import the code and the class (as it is) within a B4i project?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Add the class as-is to your B4i project. The code in the main module will require some small changes.
     
    luke2012 likes this.
  4. Rusty

    Rusty Well-Known Member Licensed User

    In post #14, I asked if one could put EditTexts in the xCustomListView.
    In fact, you can :)
    I have added rows of "items" into the clv that contain panels which contain a label and an EditText view.
    It is important to my application that when the EditText gains/loses focus that I suppress the soft keyboard with IME and then show my own custom keyboard.
    When the EditText is touched the FIRST time, this works great :)
    If you exit the EditText (change focus to something else), the custom keyboard disappears as appropriate, but when you touch the same EditText to regain focus, the Focus Changed event does NOT fire...
    However, the soft keyboard does pop-up...
    When you touch the soft keyboard, the Focus Changed event then DOES fire...
    Am I doing something wrong? When I load the CLV, I load a .bal file with the EditText defined within...
    Any ideas are welcome...
    Rusty

    UPDATE: The Focus Changed event does not fire when you touch the soft keyboard, it is the TextChanged event...
    FURTHER UPDATE: I updated Erel's example and placed an edittext within the .Bal file. It generated the CLV with the label, button, chechbox and edittext views as planned.
    When I touch the edittext, the hasfocus fires. If i touch any other edittext, the hasfocus fires, if i touch a button, checkbox or label, the hasfocus does NOT fire.
    Is there a way to make the focus change when another type view is touched?
     
    Last edited: Nov 17, 2017
  5. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question.
     
    Rusty likes this.
  6. Rusty

    Rusty Well-Known Member Licensed User

    Reposted to here, if anyone wants to follow this.
     
  7. Sapta

    Sapta Member Licensed User

    Hi @Erel

    Can I request for the next version ?
    At _ReachEnd event, can be added ProgressBar at the bottom like PullToRefresh like example here
    Thank you
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    V1.20 is released with support for horizontal orientation.
     
    themr23, Sapta and johndb like this.
  9. Dadaista

    Dadaista Member Licensed User

    Hi

    I have changed old CLV for new CLV

    I get this error

    Code:
    Registo conectado a:  Sunstech TAB109QCBT
    --------- beginning of main
    *** 
    Service (starter) Create ***
    ** 
    Service (starter) Start **
    ** 
    Activity (main) Create, isFirst = true **
    customlistview_designercreateview (B4A line: 
    46)
    sv.ScrollViewInnerPanel.Color = xui.PaintOrColorT
    java.lang.NullPointerException: Attempt 
    to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
       at anywheresoftware.b4a.objects.B4XViewWrapper$XUI.PaintOrColorToColor(B4XViewWrapper.java:527)
       at com.dbsaiz.caja.venta.free.customlistview._designercreateview(customlistview.java:
    475)
       at java.lang.reflect.Method.invoke(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:
    372)
       at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    186)
       at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:
    67)
       at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:
    162)
       at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:
    209)
       at com.dbsaiz.caja.venta.free.main._activity_create(main.java:
    516)
       at java.lang.reflect.Method.invoke(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:
    372)
       at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    186)
       at com.dbsaiz.caja.venta.free.main.afterFirstLayout(main.java:
    102)
       at com.dbsaiz.caja.venta.free.main.access$
    000(main.java:17)
       at com.dbsaiz.caja.venta.free.main$WaitForLayout.run(main.java:
    80)
       at android.os.Handler.handleCallback(Handler.java:
    739)
       at android.os.Handler.dispatchMessage(Handler.java:
    95)
       at android.os.Looper.loop(Looper.java:
    135)
       at android.app.ActivityThread.main(ActivityThread.java:
    5254)
       at java.lang.reflect.Method.invoke(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:
    372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
    903)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    698)
    Object context 
    is paused. Ignoring CallSubDelayed: AfterLoadLayout
    Object context 
    is paused. Ignoring CallSubDelayed: AfterLoadLayout
    My CLV's are created in run time

    How can I solve it?
     
    Last edited: Dec 28, 2017
  10. Erel

    Erel Administrator Staff Member Licensed User

    xCustomListView as well as the latest versions of CLV must be added with the designer. You can create a layout file with only a CLV and load it whenever you want to create one.
     
  11. Dadaista

    Dadaista Member Licensed User

    Hi!!

    Ok Erel

    Thx!!:)
     
  12. janderkan

    janderkan Active Member Licensed User

    Hi All
    I have downloaded the project attached to post #1 (v1.20)
    It compiles and runs with no problems.
    But when i add a new layout to the project, I get the following error when calling 'Activity.LoadLayout("2")'
    java.lang.RuntimeException: java.lang.RuntimeException: CustomView CustomType property was not set.
    (I did search the forum, but did not find any solution)
    In the designer the Custom type property is greyed out, so it is not possible to change it.

    Starting a new project does not help.

    Biggest problem is that an existing project where I use CustomListView v1.76 suddenly have the exact same problem.

    B4A - 7.80
    JDK - 8.152
    Android 27

    Latest info !!
    Downgraded to B4A 7.30 - Problem solved :) !!!! or :( ...

    Latest-Latest info !!
    7.30 - 7_3.jpg 7,80 - 7_8.jpg
    In the designer when I select 'Add View' the arrow next to CustomView is missing in B4A 7.80
     
    Last edited: Jan 1, 2018
  13. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread in the questions forum and upload the project that fails to compile.

    Make sure not to confuse between:
    1. This class.
    2. The old CustomListView class.
    3. CustomListView library.
     
  14. XbNnX_507

    XbNnX_507 Active Member Licensed User

    is it possible to use VisibleRangeChanged event to reuse the views in runtime instead of creating and removing these?
    ( similar to the way recycle view works).
     
  15. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question.
     
  16. XbNnX_507

    XbNnX_507 Active Member Licensed User

  17. Angel Garcia

    Angel Garcia Member Licensed User

    Hi All,
    I'm trying to use a CLV with horizontal scrolling with no success, i set it as the tutorial:
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,180dip,CLVMap.AsView.Height)
    CLVMap.Add(p, cd)
    But i'm still getting items added vertically, any help would be appreciated.

    EDIT:
    LOL i didn't see it "set it in the designer", ROFLCOPTER, i'm sorry :(

    Thanks!
     
    Last edited: Jan 22, 2018
  18. Claudio Oliveira

    Claudio Oliveira Active Member Licensed User

    Hi Erel,
    At video time 2:17 I noticed that class version is 1.51, but the one attached to the first post is still 1.50.
    Are there changes coming?
     
    Erel and Peter Simpson like this.
  19. Erel

    Erel Administrator Staff Member Licensed User

    V1.51 was uploaded now.
     
  20. Claudio Oliveira

    Claudio Oliveira Active Member Licensed User

    @Erel ,
    Apparently there's a mistake in RemoveAt sub.
    When there are text items in the list, RemoveAt sub calculates NewOffset values incorrectly.

    This code line
    Code:
    Dim NewOffset As Int = item.Offset - item.Size - DividerSize
    Should be like this
    Code:
    Dim NewOffset As Int = item.Offset - RemoveItem.Size - DividerSize
    Regards
     
    Peter Simpson, janderkan and Erel like this.
Thread Status:
Not open for further replies.
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