When the page is first shown, it looks like this:
There are times when (someone) wishes the map could be shown full screen, as in the first image above...:
Since the buildpage uses a container for the grid, page.cell(3,1) (3 wide) and the Gmap in page.cell(3,2) (9 wide), I desired a method to show the map full screen when desired (click on the Icon next to REFRESH to toggle ).
The only way around this, I found was to reserve a row, page.cell(2,1) (12 wide).
B4X:
Buildpage...
page.AddRowsM( 1,False, 10, 3, "rowtheme").AddCellsOSMP(1,0,0,0, 3,3,3, 2 , 0, 0,0,"cnter") .AddCellsOSMP(3,0,0,0,3,3,3, 5, 5, 0, 0,"cnter") ' top row with buttons
page.AddRowsM(1 ,False, 0,0,"") .AddCellsOSMP(1,0,0,0,12,12,12,0,0,0,0, "") ' reserved row for full screen Gmap
page.AddRows(3 ,False, "") .AddCellsOSMP(1,0,0,0,3,3,3,0,0,0,0, "").AddCellsOSMP(1,0,0,0,9,9,9,0,0,10,0, "") ' some spare rows....
The ToggleMap_Clicked method:
B4X:
Sub btntogmap_Clicked(Target As String)
Dim hgt As Int = 750 ' default height
Try
Dim browwh As String = ABM.GetBrowserWidthHeight(page)
Log(" page info: "&browwh)
Dim idx As Int = browwh.IndexOf(";")
Dim hgt As Int = browwh.SubString(idx+1)
Log("map hgt: "&hgt)
Catch
Log("Last error init map: "&LastException.Message)
End Try
' set full screen or normal view
' remove component and add Gmap to the correct row, cell
If maptog Then ' global var
maptog = False
page.Cell(2,1).RemoveAllComponents
gm1.Initialize(page,"gm1", 0,0 , 14, hgt-130 ,ABM.GOOGLEMAPTYPE_SATELLITE,0)
page.Cell(3,2).AddComponent(gm1)
Else
maptog = True
page.Cell(3,2).RemoveAllComponents
gm1.Initialize(page,"gm1", 0,0 , 14, hgt-130 ,ABM.GOOGLEMAPTYPE_SATELLITE,0)
page.Cell(2,1).AddComponent(gm1)
End If
LoadCases(1,False)
gm1.Refresh
page.Refresh
End Sub