iOS version of app displays Back button at the bottom & top lefthand corner. Why?

86 views
Skip to first unread message

cubiq1

unread,
Sep 29, 2014, 1:32:40 PM9/29/14
to codenameone...@googlegroups.com

Hi there,

For some reason when I tick the Back Command option on my app's "Sign out" command, a big "Sign out" button appears at the bottom of the iOS version of the app.

Is there anyway to have "Sign out" appear just on the top left hand corner while still acting as a back command?

Thanks


Shai Almog

unread,
Sep 29, 2014, 9:38:31 PM9/29/14
to codenameone...@googlegroups.com
Hi,
I'm not exactly sure how that happened. You cant have more than one back commands.

cubiq1

unread,
Sep 30, 2014, 5:03:23 AM9/30/14
to codenameone...@googlegroups.com

Hi,

I'm managed to recreate this behaviour using a new Hello World project.

I added two commands to my Main form (in this example "Exit" and "Settings").

I then set "Exit" as the Back Command and "Settings" to navigate to the SettingsForm (please see attached screen shots below).


This then resulted in an "Exit" button being placed at the bottom of the iOS app Main form (as well as the top left hand corner). If I remove the "Settings" command, the button "Exit" button disappears.

Any idea what the issue might be?

Thanks is advance.

Diamond

unread,
Sep 30, 2014, 7:55:33 AM9/30/14
to codenameone...@googlegroups.com
By default, If command is more than 1 on IOS and you don't indicate that other commands should be placed at a particular location....those commands will be tiled at the bottom of your screen.

 I will suggest you create your commands in code like this:

@Override
    protected void beforeMyFormName(Form f) {
        f.removeCommand(f.getBackCommand());
        f.setBackCommand(null);

        Command Exit = new Command("Exit") {

            @Override
            public void actionPerformed(ActionEvent evt) {
                if (Dialog.show("Exit", "Are you sure you want to exit?\nAll current Progress will be lost!", "Yes", "Cancel")) {
                    Display.getInstance().exitApplication();
                }
            }
        };

      Command Settings = new Command("Settings") {

            @Override
            public void actionPerformed(ActionEvent evt) {
                  showForm("Settings_Form", null);
            }
        };

        f.setBackCommand(Exit);
        f.addCommand(Settings);
        f.revalidate();
    }

cubiq1

unread,
Sep 30, 2014, 1:03:18 PM9/30/14
to codenameone...@googlegroups.com
Hi,

Thanks for the help. This works but for the fact that people using the Java ME version of the app on a device which doesn't have a hardware back button won't be able to sign out.

Any other suggestions? I still don't know why the iOS app is inserting an extra button.

Cheers

cubiq1

unread,
Sep 30, 2014, 1:12:47 PM9/30/14
to codenameone...@googlegroups.com
I managed to solve the missing "Sign out" button in the Java ME app by doing this:

    f.setBackCommand(signOut);
    f
.addCommand(settings);
    f
.addCommand(signOut);
    f
.revalidate();

Thanks again
Reply all
Reply to author
Forward
0 new messages