Hi all,
I have a page (home page) on which there will be 8 to 10 buttons to take you to various pages.
Some thing like this (but only 2 buttons)
Problem is the ButClick sub is executed for each button when ConnectPage is called.
Is there a better way to set this up?
I can post a full working example if needed.
I have a page (home page) on which there will be 8 to 10 buttons to take you to various pages.
Some thing like this (but only 2 buttons)
B4X:
Sub ButClicked(Dest As String)
ABMShared.NavigateToPage(ws,Dest,$"../${Dest}/"$)
End Sub
public Sub ConnectPage()
' connecting the navigation bar
' ABMShared.ConnectNavigationBar(page)
Dim But1 As ABMButton
But1.InitializeRaised(page,"But1","","","To page 1","mytheme")
But1.EventHandler = ButClicked("Page1")
page.Cell(1,1).AddComponent(But1)
Dim But2 As ABMButton
But2.InitializeRaised(page,"But2","","","To page 2","mytheme")
But2.EventHandler = ButClicked("Page2")
page.Cell(1,1).AddComponent(But2)
' More buts here with similar definitions
' refresh the page
page.Refresh
' Tell the browser we finished loading
page.FinishedLoading
' restoring the navigation bar position
'page.RestoreNavigationBarPosition
End Sub
Problem is the ButClick sub is executed for each button when ConnectPage is called.
Is there a better way to set this up?
I can post a full working example if needed.