Android Question SearchTemplate design

AHilberink

Active Member
Licensed User
Longtime User
Hi,

I use SearchTemplate.

How can I do:
1. make the text of the scrollview = SetTextAlignment("CENTER","LEFT")? Can someone help me out? I tried a lot of GetPanel and GetView, but did not succeed.
2. I can change the SearchField width, but in the dialog this field is still to small. I Use
B4X:
Sub btnTarief_Click
    zknTarief.SearchField.HintText = "Zoektekst ...."
    Zoektekst = zknTarief.SearchField.TextField
    Zoektekst.Width=pnlExtras.Width/2
    zknTarief.SearchField.TextField.Width=pnlExtras.Width/2
    zknTarief.SearchField.Update
    Wait For (zknDialog.ShowTemplate(zknTarief, "", "", "Annuleer")) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        btnTarief.xLBL.Text = zknTarief.SelectedItem
    End If
End Sub
I need to make the SearchField the same width as the Dialog or CustomScrollView.
3. Is there a way to get the Index Of from the List of the SelectedItem of the Dialog? I use SetItems with a List. The List items are not unique, so I need to know the Index Of.

Hope someone knows.

Kind regards,
André
 
Last edited:

Mahares

Expert
Licensed User
Longtime User
Hope someone knows.
The XUI Views lib comes with a bunch of internal layouts. One of them is: SearchTemplate.bal ( I have attached it here for you so you do not need to tamper with the lib). Add it to your B4A Project., via the add tab of your project. Then open up the bal file in the designer in your project, you will see the customlistview from which the layout was designed. You can then via the Designer change any of the properties of the views and text. Here attached I already made the change you want, but you can change it and tweak to your liking.
 

Attachments

  • searchtemplate.bal
    2.7 KB · Views: 287
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
Thanks Mahares!!

This works fine. I did not know of these possibilities.

Only my SearchField is still not shown for the full length.

My Dialogbox its sized is based on the width of the internal scrollview, the SearchField has the same width as the CustomListView.
But the visual he is aborted, so only the first part is visible:
Screenshot_20210221-205521.jpg


Is there a way to tweak this also?

Kind regards,
André
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Only my SearchField is still not shown for the full length.
Open searchtemplate.bal layout in designer. You will see the searchfield above the customlistview. Apparently, it is anchored to open up the width of the customlistview, but it does not. So, what I did was to expand the width of the searchfield beyond the width of the customlistview width and saved it. Run the project, Now the search box is wider than it was originally. Not sure it is the best way, there is an oddity about it, but works. Usually, you do not need that field to open up fully because you are only typing few characters to zoom in on your found data.
 
Upvote 0
Top