Form transition wrong direction after showing confirmation dialog

37 views
Skip to first unread message

cubiq1

unread,
Sep 23, 2014, 9:59:18 AM9/23/14
to codenameone...@googlegroups.com
Hi,

My app used to follow this navigation when pressing "Sign out":

HomeForm->SignInForm (Screen slides from left to right)

Which worked perfectly. I now added a confirmation dialog which works, but the screens now transition in the wrong direction. So the navigation is as follows:

HomeForm->ConfirmationDialog->SignInForm (Screen now slides from right to left)

Other than saving the back button command before showing the ConfirmationDialog, is there any way to show the SignInForm transitioning in the correct way?

Many thanks

Shai Almog

unread,
Sep 23, 2014, 12:04:26 PM9/23/14
to codenameone...@googlegroups.com
Hi,
just invoke the back() method to navigate backwards.
If you want to skip a form along the way just set a back destination.
Message has been deleted

cubiq1

unread,
Sep 23, 2014, 1:21:48 PM9/23/14
to codenameone...@googlegroups.com
Hi,

Setting the "Yes" button to call back() only closes the ConfirmationDialog, it doesn't cause the app to navigate to the SignInForm. Or am I missing something?

Thanks

Shai Almog

unread,
Sep 23, 2014, 10:28:04 PM9/23/14
to codenameone...@googlegroups.com
Hi,
use the setBackDestination to determine the name of the form you want to navigate back to.
Message has been deleted

cubiq1

unread,
Sep 28, 2014, 8:25:49 AM9/28/14
to codenameone...@googlegroups.com
Hi,

I've tried using setBackDestination then calling back() when "Yes" is clicked on the confirmation dialog but it still isn't working.

This does nothing but close the confirmation dialog:
   
    // On 'Sign out' button press
   
@Override
   
protected boolean onHomeFormSignOut() {
       
       
// Confirmation dialog
        showForm
("SignOutDialog", null);
       
       
return true;
   
}
   
   
// 'Yes' is clicked
   
@Override
   
protected void onSignOutDialog_YesButtonAction(Component c, ActionEvent event) {

       
// Set back destination
        setBackDestination
("SignInForm");
       
       
// Navigate back
        back
();
   
}

This, however, works but I'm not sure if it is allowed or good practice:
   
    // On 'Sign out' button press
   
@Override
   
protected boolean onHomeFormSignOut() {

       
// Save back command in class variable
        signOutBackCmd
= Display.getInstance().getCurrent().getBackCommand();
       
       
// Confirmation dialog
        showForm
("SignOutDialog", null);
       
       
return true;
   
}
   
   
// 'Yes' is clicked
   
@Override
   
protected void onSignOutDialog_YesButtonAction(Component c, ActionEvent event) {

       
// Navigate backwards
        showForm
("SignInForm", signOutBackCmd);
   
}

Any idea what I'm doing wrong?

Thanks again

Shai Almog

unread,
Sep 28, 2014, 8:51:15 PM9/28/14
to codenameone...@googlegroups.com
Hi,
I'm not 100% sure about this since I'm not totally positive I get what you are trying to do and what's happening visually (maybe its just the jetlag).
If it works for you and you are happy with it, go with it. Just keep it in mind if something breaks.

cubiq1

unread,
Sep 29, 2014, 4:15:46 AM9/29/14
to codenameone...@googlegroups.com
Thanks, it seems to be working so I'll keep it for now. I hope Java One was great! :)
Reply all
Reply to author
Forward
0 new messages