Android Question [Solved] How to increase the B4XSearchTemplate to nearly full screen size and also show title bar ?

AnandGupta

Expert
Licensed User
Longtime User
Edit: There is another solution by changing b4xsearchtemplate.bas file


I want to increase the B4XSearchTemplate to nearly full screen size.

I can get it with
B4X:
    B4XSearchTemplate1.Resize(90%x, 80%y) '<-- this increases size but removes title
this removes the title line !

I thought title is hidden, so below line moves the box down,
B4X:
    B4XDialog1.Base.Top = 50dip '<-- this moves but title gone in above case
but title bar is still missing.

x1.png

How to bring back the title and increase size ?

The sample project is attached.

Edit: Also see me notes on title here,
 

Attachments

  • Project.zip
    14.5 KB · Views: 138
Last edited:
Solution
There must be something simple, I think, to get what I want

Another way without adding any code is to add searchtemplate.bal, an internal layout located in the XUI VIES library after you unzip it. Afte you add it to the file folder of your project, add a label to it as your title and tweak the position and size above the search box., and save the layout with the change. See attached done to your project with it on. You do not even need to mess with the XUI Views lib if you use the layout I have in the attached project. Tweak it to your liking.

1644500533165.png

AnandGupta

Expert
Licensed User
Longtime User
I responded to something similar a few days ago.

https://www.b4x.com/android/forum/threads/b4x-searchtemplate-dialog-help-needed.138269/

I couldn't get the title back either. So skip the title in dialog and make your own.
But the code means I have to re-create all things.
There must be something simple, I think, to get what I want.
I have .Resize() and .Top() so the title should be there.

Since Erel liked your reply, I think it is by design of B4XSearchTemplate .
Ok. I may have (which I do not want) to look into B4XSearchTemplate codes for it.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
There must be something simple, I think, to get what I want

Another way without adding any code is to add searchtemplate.bal, an internal layout located in the XUI VIES library after you unzip it. Afte you add it to the file folder of your project, add a label to it as your title and tweak the position and size above the search box., and save the layout with the change. See attached done to your project with it on. You do not even need to mess with the XUI Views lib if you use the layout I have in the attached project. Tweak it to your liking.

1644500533165.png
 

Attachments

  • B4XSearchTemplateForAnandByMahares.zip
    16.5 KB · Views: 173
Upvote 0
Solution

AnandGupta

Expert
Licensed User
Longtime User
Thanks a lot @Mahares for the changes. 🙏

Yes I have already extracted and renamed,
gB4XSearchTemplate.bas
gB4XDialog.bas
also searchtemplate.bal
And made few changes here and there and understood that title is from b4xdialog and so I have to resize/move it too.

But man, the codes are very high level from my knowledge point of view :)

Your idea of adding title in search works well, but I am getting error if I want to change title text from code,
B4X:
Private Sub Button1_Click

'    B4XDialog1.Title = "Tittle1"
    B4XSearchTemplate1.Resize(90%x, 80%y)
    Dim dia As  Object = B4XDialog1.ShowTemplate(B4XSearchTemplate1, "", "", "Close")
'    B4XDialog1.Base.Top = 50dip

'    lblTitle.Text = "Tittle1"    '<-- this gives error (shd be first initialize)


    Wait For (dia) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Log(B4XSearchTemplate1.SelectedItem)
    End If   
   
End Sub

B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private B4XSearchTemplate1 As B4XSearchTemplate
    Private B4XDialog1 As B4XDialog
    Private lblTitle As Label
End Sub

Any help on how to fix it is appreciated.
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Hi @Mahares

I am marking your reply as solution as it helped me get what I want. 🙏

I found the code to set the title,
B4X:
    B4XSearchTemplate1.mBase.GetView(0).As(Label).Text = "test1"
(I moved the label at top in designer)

So this fulfills my request. Also I learnt that 'only extracting the .bal and using it in files, the library uses that .bal file and not from its own files. 👍
This opens up many more possibilities.
 
Upvote 0
Top