Android Question B4XSearchTemplate: Max number of items to show

ST500

Active Member
Licensed User
Hi Guys,

the list contains about 15 items. When I'm typing to the searchfield so I would like to get showed max number of possible items.

In the first I would like to set the max to 15 or not the standard 3 items.

Thanks for your help.

Martin
 

Mahares

Expert
Licensed User
Longtime User
In the first I would like to set the max to 15 or not the standard 3 items
I do not know if this is the best way to do it or not, but this is how I got it to expand the height of the search list:
In the internal libraries folder there is a file: XUI Views.b4xlib. Rename it to XUI Views.zip and then unzip it somewhere on your PC. You will see a class module called: B4XSearchTemplate.bas. Open it via Notepad ++
Replace this line:
B4X:
If xui.IsB4A Or xui.IsB4i Then height = 220dip Else height = 300dip
With this line:
B4X:
If xui.IsB4A Or xui.IsB4i Then height = 600dip Else height = 300dip
You can change the height to other than 600 dip. Then zip it and rename it back to XUI Views.b4xlib and recopy it to the internal libraries folder. Refresh your project.
Again that is what I did and the visible list of item shows a lot more than 3 items. In summary you need to edit the XUI Views.b4xlib library
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I do not know if this is the best way to do it or not, but this is how I got it to expand the height of the search list:
This is not the recommended way to make such changes. You should copy the class and rename it (MySearchTemplate). Add it to your project and use it instead of B4XSearchTemplate.
This way you will not need to repeat this change whenever XUI Views is updated.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
This is not the recommended way to make such changes
Would it be easier if you implement the request by @ST500 in the next update of B4X Views.4bxlib so a user can set the height of the template in code without having to tamper with the class or lib? It appears that his request is quite viable. Many users will potentially want it.
 
Last edited:
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
I don't know if that's the best way either, but this worked for me.

B4X:
    SearchTemplate.Initialize
    SearchTemplate.MaxNumberOfItemsToShow=15
    Dim pane As Panel = SearchTemplate.GetPanel(Dialog)                        'Get the main panel
    pane.Height=600dip                                                                          'Set Desired Height
    Dim lv As B4XView = SearchTemplate.CustomListView1.AsView             'Get the List View
    lv.Height=pane.Height                                                                       'Set Same as Parent
    Dim sv As B4XView=lv.GetView(0)                                                      'Get the Scroll View
    sv.Height=pane.Height                                                                       'Set Same as Parent
 
Upvote 0

ST500

Active Member
Licensed User

Thanks, I will test it
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…