1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

B4i Library [class] SearchView

Discussion in 'iOS Libraries' started by Erel, Dec 24, 2014.

  1. Erel

    Erel Administrator Staff Member Licensed User

    This class is similar to B4A SearchView class. It allows the user to filter a list of items based on a term (prefix matches first followed by other matches).

    It uses the new RichString class to highlight the matching terms. Note that the scrolling and filtering performance in release mode are very good. It can be a bit jumpy in debug mode.



    New version of SearchView is now available. It is implemented as a custom view. It also properly handles the keyboard state.
     

    Attached Files:

    Last edited: Feb 1, 2016
  2. miker2069

    miker2069 Active Member Licensed User

    Is it possible to add an item with more than just one line? I believe with the equivalent in B4A you can add singleline and doubleline. Is it possible to add a custom view or something (i.e., an entry with a line and an icon?)
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Edit CustomListView.SetCache and set lbl.Multiline = True.

    You can further customize it with any view you like.
     
  4. miker2069

    miker2069 Active Member Licensed User

    Erel, thank you very much!
     
  5. Shay

    Shay Well-Known Member Licensed User

    How do I put default text on it
    there is no sv.text = "something"

    and second question, how do I do sv2.enabled = false
    since I want to enable it only after sv1.text has something in it
    (sv1 = cities, sv2 = streets)
    I wish to load only the relevant streets by city
     
    Last edited: Feb 13, 2015
  6. Erel

    Erel Administrator Staff Member Licensed User

    Go over the code, most of it is not too complicated and change it in any way you like.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    I've uploaded a new version of SearchView that is based on TableView instead of CustomListView. This change simplifies the code and improves the performance (in the previous implementation there were caches and two steps loading that now are not required).
     
  8. Shay

    Shay Well-Known Member Licensed User

    I am getting error that my IDE is older (I am using 1.80)
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Please ignore it. Currently the latest version is 1.80 and it should work fine with this project.
     
  10. tufanv

    tufanv Expert Licensed User

    Erel,

    Is there any way to add a border to searchview
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    Yes, add lv.SetBorder or et.SetBorder in the Initialize sub.
     
    tufanv likes this.
  12. kemanlam

    kemanlam Member Licensed User

    where is the "cities.txt" files in the zip file?
     
  13. Erel

    Erel Administrator Staff Member Licensed User

    It should be in the Files folder.
     
  14. narek adonts

    narek adonts Well-Known Member Licensed User

    I have updated Erel's SearchView with using the iOS native SearchViewController (like in iMessage, Whatsapp, Viber,...)

    It is just the basic wrapping so you can contribute to it.

    For current users of SearchView you do not need modify anything in your code.

    Project attached.

    Narek
     

    Attached Files:

    Pooya1, GGSoft, manolitoGnet and 2 others like this.
  15. Erel

    Erel Administrator Staff Member Licensed User

    Very nice!

    upload_2015-11-30_17-19-7.png
     
    kemanlam and narek adonts like this.
  16. John Woodsmall

    John Woodsmall Active Member Licensed User

    Can this program operate against a "csv" file?
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    You need to create a List with the strings that should go to the SearchView. The data can come from any source you like including CSV (use StringUtils.LoadCSV).
     
  18. John Woodsmall

    John Woodsmall Active Member Licensed User

    This works very well on most text files. However I have 271 "Div/state" files...the entire list of cities
    in the world. The 3 one I tested is "UK.TXT" which is a simple ascii list of the cities in the UK.
    I get "encode-error" when I try to open it:"Error reading file. Incorrect encoding"

    I have checked the file and can not find any weird letters?
     

    Attached Files:

    • uk.txt
      File size:
      47.1 KB
      Views:
      11
  19. John Woodsmall

    John Woodsmall Active Member Licensed User

    In the "New" from:"narek-adonts" search view above (which I have added to my app) it does not seem to return a value to
    the sv_ItemClick(Value As String)
    .
    On the first one (above) it works correctly. But on the new one which looks great(i would love to use it)
    it does not seem to return a value. All i did was replace the new *.bas to my app.
     
  20. Erel

    Erel Administrator Staff Member Licensed User

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