Android Question B4XPages title bar

Sergey_New

Well-Known Member
Licensed User
Longtime User
In the ThreePagesExample example, when the event
B4X:
Sub btnLogin_Click
    B4XPages.ShowPage("Page 2")
End Sub
This page displays "Page 2" in the title bar.
How can I get this string in the B4XPage2 class code?
 

William Lancee

Well-Known Member
Licensed User
Longtime User
You can use these lines in any page - Me is the page object.
B4X:
    B4XPages.SetTitle(Me, "My Title or anything you want")
    Log(B4XPages.GetPageId(Me))
 
Upvote 0
Solution

Sergey_New

Well-Known Member
Licensed User
Longtime User
Oops, instead of "Page 2" it returns "page 2".
Is there any way to fix this?
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
Page ids are converted to lowercase when added with B4XPages.AddPage because they become keys in an internal Map.
We need to know more about your page naming convention to find the best way to recover the original caseness.

However you can always keep a global Map that converts lowercase names back to original names.
AKA = also known as

Note that page names in all B4XPages Sub arguments are case insensitive, so you may not need the original name.

B4X:
'In B4XMainPage Sub Class_Globals
'Public AKA As Map

Private Sub B4XPage_Created (Root1 As B4XView)
    AKA.Initialize
    Dim thisXPage As XPage
    thisPAge.Initialize
    B4XPages.AddPage("InstanceName", thisPage)
    AKA.Put("InstanceName".ToLowerCase, "InstanceName")
    '...
End Sub

'In XPage code
log(B4XMainPages.MainPage.AKA.Get(B4XPages.GetPageId(Me)))
 
Last edited:
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
William Lancee, thank you.
I understood you.
 
Upvote 0
Top