CIQ 3.0.7
Device: FR935
Test Case
1) Create widget app and run it
2) Push second view (e.g. onSelect())
3) Don't handle onPreviousPage() (or return false)
Observed Behaviour
In the sim, nothing happens if the user presses UP. On a real 935, the widget closes (and the previous widget in the loop is displayed).
I assume the same thing would happen when the user presses DOWN, and onNextPage()/KEY_DOWN is not handled.
Expected Behaviour
Sim behaves as real device (at least the widget should close, just as it would if you pressed UP on the initial view)
EDIT: I should've said that I expected the real device to behave as the sim (and do nothing), but of course it all depends on the intended behaviour.
Sample Code
using Toybox.WatchUi;
using Toybox.Application;
class widgettestApp extends Application.AppBase {
function initialize() {
AppBase.initialize();
}
// onStart() is called on application start up
function onStart(state) {
}
// onStop() is called when your application is exiting
function onStop(state) {
}
// Return the initial view of your application here
function getInitialView() {
return [ new widgettestView(), new widgettestInputDelegate() ];
}
}
class widgettestView extends WatchUi.View {
function initialize() {
View.initialize();
}
// Load your resources here
function onLayout(dc) {
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() {
}
// Update the view
function onUpdate(dc) {
// 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() {
}
}
class widgettestInputDelegate extends WatchUi.BehaviorDelegate {
function onSelect() {
System.println("pushing new view");
WatchUi.pushView(new SecondView(), new SecondDelegate(), WatchUi.SLIDE_IMMEDIATE);
}
}
class SecondView extends WatchUi.View {
function initialize() {
View.initialize();
}
// Load your resources here
function onLayout(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() {
}
// Update the view
function onUpdate(dc) {
// 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() {
}
}
class SecondDelegate extends WatchUi.BehaviorDelegate {
// same behaviour if this function simply not defined, I think
function onPreviousPage() {
System.println("return false in onPreviousPage");
return false;
}
}