Windows UWP navigation

31 views
Skip to first unread message

mcw

unread,
Nov 10, 2016, 2:59:47 PM11/10/16
to CodenameOne Discussions
I am testing my apps on the Windows UWP platform. I am using a Microsoft Surface Book for testing. I don't yet have a Windows 10 phone to test with.

My app starts, user makes a selection and a new form is displayed. How do I get back to the previous form?

When building the new form my code includes:

        _backCommand = new Command(Prefs.getMsg("rw.msg.nv.lst"));
        setBackCommand
(_backCommand);

There is no back button displayed on the screen.

In the simulator I use the hardware back button and it works as expected.

I detach the display so that I have a Windows tablet. In tablet mode the buttons are displayed on the bottom of the screen but touching the back button takes me to the desktop. My app is still running but hidden. When I bring it to the front it is still on the second form. How do I go back to the first form?

When I switch from tablet to desktop mode my app is killed. Not sure if that is the expected behavior or not.

When I run my app in desktop mode there is no simulated back button and no back button displayed in the app. How do I return to the first form?

Thanks

Shai Almog

unread,
Nov 11, 2016, 12:36:38 AM11/11/16
to CodenameOne Discussions
For consistency with back navigation I suggest using the Toolbar and setBackCommand on the Toolbar itself so it will exist in all platforms.

The hardware button should map that's probably an issue Steve can address.

mcw

unread,
Nov 11, 2016, 2:34:37 PM11/11/16
to CodenameOne Discussions
I have never been a fan of the Toolbar, it never looks quite right to me, especially on older devices.

I don't think you always want the back button displayed, it should only be displayed when appropriate.

On a Windows Mobile Phone with a hardware back button, you would not want it. Same with a laptop in tablet mode. i will open a bug on the back button not working.

The only time you would want it is when the app is running on a laptop in desktop mode. Then you would want it displayed in the app like Windows 10 Settings does.

Thanks

Shai Almog

unread,
Nov 12, 2016, 12:23:45 AM11/12/16
to CodenameOne Discussions
The problem is that it is getting really hard to know when to show it. Back in the day we only showed it for iOS but now Android wants it and it's important for desktop and other ports.
I see your point but with the current state of mobile devices I'd just put a back button and forget about it...

Bryan Buchanan

unread,
Nov 12, 2016, 2:17:30 PM11/12/16
to CodenameOne Discussions
I would agree with Shai - Android and iOS use a back button, and it doesn't look out of place on UWP devices - in fact I think the consistency that CN1 allows across platforms is a good thing.

I've not experienced any problems with back button code on UWP devices.

mcw

unread,
Nov 12, 2016, 4:00:03 PM11/12/16
to CodenameOne Discussions
I vote for native look and feel versus consistency across platforms. I understand the point but I would rather my app looked like a real Windows Mobile app.

I do actually add the back button on Windows but on the form level:


        _backCommand = new Command(Prefs.getMsg("rw.msg.nv.lst"));
        setBackCommand
(_backCommand);

This adds the back button to the title bar on iOS and Android but not on Windows. Initially I thought that was fine because on a Windows phone you have the hardware back button.Unfortunately a Windows app can run in a lot of different modes and the hardware back button is not always there.

I am reluctant to use the Toolbar class as that does not seem like the native look and feel to me.

Shai Almog

unread,
Nov 12, 2016, 10:24:44 PM11/12/16
to CodenameOne Discussions
If the Toolbar is lacking in native feel then file RFE's with screenshots/requests and we can tune that.

As you indicated Windows is a problematic platform where this is "sometimes" needed. In the past we had a hint for the entire platform saying if this was needed but for Windows that's a problem.
Reply all
Reply to author
Forward
0 new messages