Hello!
I'm a beginner in garmin developing APP.. I have a Fenix 5x plus and I want to make a Windsurf APP.
the ideia is have an app with all my information about windsurf equipment.
when going windsurf, I will run the app, choose what sail I will use, what board and what fin, then it will only track me and record how many jibes, jumps and shows live time and speed.
I already search on this forum about my doubts but I still have ones.
To create a Menu 2, what I'm doing wrong?
what is the best way to create a menu like:
the menu is pre defined by me, will be like.
Sails
- 11 m2
- 9.4 m2
- 7.8 m2
- 7.1 m2
- 6 m2
etc...
Boards
- Formula 161l
- Isonic 127l
- Simmer 116l
etc...
Fins
- 70 boss
- 70 Zfins
- 44 Vmax
-39 SMAX
etc...
I know it will be very hard to make this kind of app, but lets give a try...
maybe 10 years a go on my free times I used to be "web developer", using javascript, php, Ajax, ASP, mySQL, HTML :D
Thanks!!!
menu.xml
<menu id="mainMenu_Windsurf"> <menu-item id="item_sail" label="@Strings.menu_sail" /> <menu-item id="item_board" label="@Strings.menu_board" /> </menu>
strings.xml
<strings> <string id="AppName">teste4</string> <string id="prompt">Windsurf APP</string> <string id="menu_sail">Sail</string> <string id="menu_board">Board</string> </strings>
teste4App.mc
import Toybox.Application; import Toybox.Lang; import Toybox.WatchUi; class teste4App extends Application.AppBase { function initialize() { AppBase.initialize(); } // onStart() is called on application start up function onStart(state as Dictionary?) as Void { } // onStop() is called when your application is exiting function onStop(state as Dictionary?) as Void { } // Return the initial view of your application here function getInitialView() as Array<Views or InputDelegates>? { return [ new teste4View(), new teste4Delegate() ] as Array<Views or InputDelegates>; } } function getApp() as teste4App { return Application.getApp() as teste4App; }
teste4Delegate.mc
import Toybox.Lang; import Toybox.WatchUi; class teste4Delegate extends WatchUi.BehaviorDelegate { function initialize() { BehaviorDelegate.initialize(); } function onMenu() as Boolean { var menu = new WatchUi.Menu2({:title=>"Wind Surf"}); menu.addItem(new WatchUi.MenuItem("Sails",null,"item_sail",{})); menu.addItem(new WatchUi.MenuItem("Boards", null,"item_board", null)); WatchUi.pushView(menu, new teste4MenuDelegate(), WatchUi.SLIDE_IMMEDIATE); return true; } }
teste4MenuDelegate.mc
import Toybox.Lang; import Toybox.System; import Toybox.WatchUi; class teste4MenuDelegate extends WatchUi.MenuInputDelegate { function initialize() { MenuInputDelegate.initialize(); } function onMenuItem(item as Symbol) as Void { // quando carrega no bortao "vermelho" if (item == :item_sail) { System.println("VELAS"); //CREATE SUB MENU var menu_sub = new WatchUi.Menu2({:title=>"Sails Size"}); menu_sub.addItem(new WatchUi.MenuItem("7.8",null,"sail1",null)); menu_sub.addItem(new WatchUi.MenuItem("7.1", null,"sail2", null)); menu_sub.addItem(new WatchUi.MenuItem("6", null,"sail3", null)); WatchUi.pushView(menu_sub, new teste4MenuDelegate(), WatchUi.SLIDE_IMMEDIATE); } else if (item == :sail1) { System.println("you chose sail 7.8"); } else if (item == :sail2) { System.println("you chose sail 7.1"); } else if (item == :item_board) { System.println("PRANCHAS"); } } }
teste4View.mc
import Toybox.Graphics; import Toybox.WatchUi; class teste4View extends WatchUi.View { function initialize() { View.initialize(); } // Load your resources here function onLayout(dc as Dc) as Void { setLayout(Rez.Layouts.MainLayout(dc)); } // Called when this View is brought to the foreground. Restore // the state of this View and prepare it to be shown. This includes // loading resources into memory. function onShow() as Void { } // Update the view function onUpdate(dc as Dc) as Void { // Call the parent onUpdate function to redraw the layout View.onUpdate(dc); } // Called when this View is removed from the screen. Save the // state of this View here. This includes freeing resources from // memory. function onHide() as Void { } }
so... the only error is when I push the select button on "Sails", instead of open a new menu with new options (sail sizes), it doesn't do nothing...
Error: Symbol Not Found Error Details: Failed invoking <symbol> Stack: Encountered app crash.