Hi Erel,
I would like to create a simple Top Right menu with 3 buttons and each button has an event to run code. I am posting the code to know what is correct and if any part is redundant. Also any reason we use the new NavigationController rather than the one passed as a parameter for Application_Start?
Code
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private smc As SideMenuController
End Sub
Private Sub Application_Start (Nav As NavigationController)
'create a new navigation controller
Dim nc As NavigationController
nc.Initialize("nc")
NavControl = nc
Dim btn1 As Button
btn1.Initialize("btn1")
btn1.Text = "Halt"
Dim btn2 As Button
btn2.Initialize("btn2")
btn2.Text = "Configure"
Dim btn3 As Button
btn3.Initialize("btn3")
btn3.Text = "Drones"
Dim rp As Page
rp.Initialize("rp")
rp.RootPanel.Color = Colors.Green
rp.RootPanel.AddView(btn1,20,20,100,30)
rp.RootPanel.AddView(btn2,20,60,100,30)
rp.RootPanel.AddView(btn3,20,100,100,30)
smc.Initialize(Null, nc, rp)
App.KeyController = smc
Page1.TopRightButtons = Array(smc.CreateBarButton("Menu"))
nc.ShowPage(Page1)
End Sub
Sub Page1_BarButtonClick (Tag As String)
Select Tag
Case "Menu"
smc.OpenRightMenu
End Select
End Sub
Sub Page1_Click
smc.OpenRightMenu
End Sub
sub btn3_click
DroneE
end sub
sub btn2_click
ConfigureE
end sub
sub btn1_click
timer1.Enabled=False
timer2.Enabled=False
timer3.Enabled=False
timer4.Enabled=False
timer5.Enabled=False
timerdelay.Enabled=False
timersocket.Enabled=False
end sub
I would like to create a simple Top Right menu with 3 buttons and each button has an event to run code. I am posting the code to know what is correct and if any part is redundant. Also any reason we use the new NavigationController rather than the one passed as a parameter for Application_Start?
Code
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private smc As SideMenuController
End Sub
Private Sub Application_Start (Nav As NavigationController)
'create a new navigation controller
Dim nc As NavigationController
nc.Initialize("nc")
NavControl = nc
Dim btn1 As Button
btn1.Initialize("btn1")
btn1.Text = "Halt"
Dim btn2 As Button
btn2.Initialize("btn2")
btn2.Text = "Configure"
Dim btn3 As Button
btn3.Initialize("btn3")
btn3.Text = "Drones"
Dim rp As Page
rp.Initialize("rp")
rp.RootPanel.Color = Colors.Green
rp.RootPanel.AddView(btn1,20,20,100,30)
rp.RootPanel.AddView(btn2,20,60,100,30)
rp.RootPanel.AddView(btn3,20,100,100,30)
smc.Initialize(Null, nc, rp)
App.KeyController = smc
Page1.TopRightButtons = Array(smc.CreateBarButton("Menu"))
nc.ShowPage(Page1)
End Sub
Sub Page1_BarButtonClick (Tag As String)
Select Tag
Case "Menu"
smc.OpenRightMenu
End Select
End Sub
Sub Page1_Click
smc.OpenRightMenu
End Sub
sub btn3_click
DroneE
end sub
sub btn2_click
ConfigureE
end sub
sub btn1_click
timer1.Enabled=False
timer2.Enabled=False
timer3.Enabled=False
timer4.Enabled=False
timer5.Enabled=False
timerdelay.Enabled=False
timersocket.Enabled=False
end sub