In the B4XMainPage, I want to show the Logon_Page for user to logon but the layout of logon_page was not loaded just empty Logon_Page was showed, how to solve this?
Where is the bets appropriate module to declare global variables Stater or B4XMainPage?
Thanks for any help
B4XMainPage:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
B4XPages.SetTitle(Me,"Home")
' Init pages and add pages to B4XPages collection
StartPage.Initialize
B4XPages.AddPage("Start_Page",StartPage)
CustomerPage.Initialize
B4XPages.AddPage("Customer_Page",CustomerPage)
LogonPage.Initialize
B4XPages.AddPage("Logon_Page",LogonPage)
' Show logon page
B4XPages.ShowPageAndRemovePreviousPages("Logon_Page")
End Sub
I was reviewing your example and I am left wondering:
How does "the click of the button" work?
If the button is not defined
B4X:
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private txtUserName As B4XFloatTextField
Private txtUserPaword As B4XFloatTextField
End Sub
B4X:
Private Sub btnLogin_Click
'Return MainPage
If txtUserName.Text = "" Then
xui.MsgboxAsync("Enter user name", "Warning")
Return
End If
If txtUserPaword.Text = "" Then
xui.MsgboxAsync("Enter password", "Warning")
Return
End If
B4XPages.ShowPageAndRemovePreviousPages("MainPage")
End Sub
The way I have understood it, as long as the button is in the designer, you do not need to declare the button in the Class_Globals if you use it for the click event. For anything else, you need to declare it.
I was reviewing your example and I am left wondering:
How does "the click of the button" work?
If the button is not defined
B4X:
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private txtUserName As B4XFloatTextField
Private txtUserPaword As B4XFloatTextField
End Sub
B4X:
Private Sub btnLogin_Click
'Return MainPage
If txtUserName.Text = "" Then
xui.MsgboxAsync("Enter user name", "Warning")
Return
End If
If txtUserPaword.Text = "" Then
xui.MsgboxAsync("Enter password", "Warning")
Return
End If
B4XPages.ShowPageAndRemovePreviousPages("MainPage")
End Sub