Overriding getFirstFormName() causing backwards navigation problems

18 views
Skip to first unread message

cubiq1

unread,
Aug 19, 2014, 6:40:03 AM8/19/14
to codenameone...@googlegroups.com
Hi,

I have overridden getFirstFormName() to display my app's LoginForm if "Remember me" is false, otherwise it displays the HomeForm.

    @Override
   
protected String getFirstFormName() {
       
       
if (Preferences.get("RememberMe", false)) {
           
return "HomeForm";
       
} else {
           
return "LoginForm";
       
}
   
}

My problem is that if I start the app having previously logged-in selecting "Remember me" and then want to log out from HomeForm, LoginForm isn't on the stack. So I have to show the LoginForm using showForm() which makes the screen transition from right-to-left, which is incorrect.

Is there any way to make the screen transition from left-to-right even though LoginForm isn't on the stack?

Many thanks

Shai Almog

unread,
Aug 19, 2014, 11:08:13 AM8/19/14
to codenameone...@googlegroups.com
Hi,
set the back command to an arbitrary command then in the show form call give the command as an argument.

cubiq1

unread,
Aug 19, 2014, 11:11:14 AM8/19/14
to codenameone...@googlegroups.com
Thanks, this is working:

showForm("LoginForm", Display.getInstance().getCurrent().getBackCommand());

However, iOS7 how displays the text "Log out" at the top left as well as across the bottom of the app HomeForm.

Is there any way to remove this bottom button, as it looks out of place.

Thanks

Shai Almog

unread,
Aug 20, 2014, 12:49:58 AM8/20/14
to codenameone...@googlegroups.com
It actually might work if there already is a back command. So only set the back command if getBackCommand() == null otherwise use the existing back command as you have.
Reply all
Reply to author
Forward
0 new messages