Android Code Snippet [Solution] Increase B4XSearchTemplate without losing title bar (.bas changes)

Well my problem of 'title missing' , refer below thread, is solved by changing the.bal file and adding a title label, thanks to Mahares.

But the programmer in me could not sleep as 'why the title vanishes' if .resize() even 50% of screen !
So I extracted and renamed (as advised always) 'gB4XSearchTemplate.bas' and debugged it.

Lo ! and behold !! I found the code which was acting up.
B4X:
Private Sub Show (Dialog As B4XDialog)
    xDialog = Dialog
'    xDialog.PutAtTop = xui.IsB4A Or xui.IsB4i                               '<-- this is harcoded and reason of removing title
    CustomListView1.AsView.Color = xui.Color_Transparent
    CustomListView1.sv.Color = xui.Color_Transparent
    mBase.Color = xui.Color_Transparent
    Sleep(20)
    Update("", True)
    CustomListView1.JumpToItem(0)
    SearchField.Text = ""
    SearchField.TextField.RequestFocus
    #if B4A
'    IME.ShowKeyboard(SearchField.TextField)                        '<-- auto opened keyboard unnecessarily hides half of small list
    #end if
End Sub

Then the code in 'B4XMainPage.bas' does not require and special code for title and the original .bal file remains as it is.
B4X:
Private Sub Button1_Click
    B4XDialog1.Title = "Tittle"
    B4XDialog1.TitleBarHeight = 80
   
    B4XSearchTemplate1.Resize(90%x, 80%y)                                  ' No problem in resize with whatever size required
    Wait For (B4XDialog1.ShowTemplate(B4XSearchTemplate1, "", "", "Close")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Log(B4XSearchTemplate1.SelectedItem)
    End If   
   
End Sub

x1.png

Since this requires changes in bas file so I wish Erel to give options to disable them, keep it true by default.
We can change nearly all aspects of B4XSearchTemplate, except these two. So giving options for them is easier than making changes by programmer in .bas file.
Hope he grants our wish, when he is free.

Also attached the full project.
 

Attachments

  • Project.zip
    17.3 KB · Views: 177
Top