My application's first screen is a column of buttons serving as a menu of various calculation routines. I named the layout "menu". When a button is selected, a new layout appears with the views for that particular routine. The new layout then has a button to get back to the main menu for selecting other menu items after finishing with the current routine. However, when the menu layout comes up again (which sometimes fails), I am unable to click different buttons to go to another menu item. The next menu item won't activate. Here is an example of the code, leaving out the many globals :
Everything works fine in accessing the menu item.
The problem appears getting back to the menu and then being able to select a different item as shown in an excerpt from the "area" layout after being activated from the Menu. The other routines act similarly.
Not sure of the significance but the module containing the Menu layout is named "Main". The others are named the same as the layout. Any help will be appreciated. Thank you.
Jim Schuchert
B4X:
Sub Activity_Create(FirstTime As Boolean)
activity.LoadLayout ("menu")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnArea_click
removeviews
activity.LoadLayout ("area") [color=green]' one of the menu items[/color]
StartActivity("area") [color=red]should this appear here?[/color]
End Sub
Sub btnembed_click
removeviews
activity.loadLayout("embed") [color=green]another menu item[/color]
StartActivity("embed")
End Sub
Sub btnStart_click
removeviews
activity.loadLayout("start") [color=green]'and another [/color]
'StartActivity("start")
End Sub
Sub removeviews
Dim i As Int
For i=activity.NumberOfViews-1 To 0 Step -1
activity.removeviewat(i)
Next
End Sub
The problem appears getting back to the menu and then being able to select a different item as shown in an excerpt from the "area" layout after being activated from the Menu. The other routines act similarly.
B4X:
Sub btnMenu_click
removeviews
activity.loadlayout ("menu")
StartActivity("menu")
End Sub
Sub removeviews
Dim i As Int
For i=activity.NumberOfViews-1 To 0 Step -1
activity.removeviewat(i)
Next
End Sub
[color=red] If this code does return to the main menu, selecting another menu button does nothing.[/color]
Not sure of the significance but the module containing the Menu layout is named "Main". The others are named the same as the layout. Any help will be appreciated. Thank you.
Jim Schuchert