Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form.addCommand not working in Windows UWP #2560

Closed
mwarnett opened this issue Sep 26, 2018 · 1 comment
Closed

Form.addCommand not working in Windows UWP #2560

mwarnett opened this issue Sep 26, 2018 · 1 comment
Assignees

Comments

@mwarnett
Copy link

mwarnett commented Sep 26, 2018

My app uses addCommand to add buttons to the bottom of the screen. These have always worked fine. I hadn't built my app in some time. I just submitted a new build, everything looks good but when I touch the buttons, nothing happens. My command listener is never called.

Here is what my app looks like in the new build:

wp_ss_20180926_0001

The buttons are there but nothing happens when I touch them. This happens on the device a Microsoft Lumia 640 LTE and in the simulator when I use the Nokia Lumia skin.

Sample code to reproduce the problem. There will be two buttons at the bottom of the screen but nothing happens when you touch them.

package com.readerware.Test;


import static com.codename1.ui.CN.*;
import com.codename1.ui.Command;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Dialog;
import com.codename1.ui.Label;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import com.codename1.io.Log;
import com.codename1.ui.Toolbar;
import java.io.IOException;
import com.codename1.ui.layouts.BoxLayout;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.io.NetworkEvent;
import com.codename1.ui.Button;
import com.codename1.ui.Component;
import com.codename1.ui.Container;
import com.codename1.ui.events.ActionListener;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.layouts.FlowLayout;

/**
 * This file was generated by <a href="https://www.codenameone.com/">Codename One</a> for the purpose
 * of building native mobile applications using Java.
 */
public class TestMain implements ActionListener{

    private Form current;
    private Resources theme;

    public void init(Object context) {
        // use two network threads instead of one
        updateNetworkThreadCount(2);

        theme = UIManager.initFirstTheme("/theme");

        // Pro only feature
        Log.bindCrashProtection(true);

        addNetworkErrorListener(err -> {
            // prevent the event from propagating
            err.consume();
            if(err.getError() != null) {
                Log.e(err.getError());
            }
            Log.sendLogAsync();
            Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
        });
    }

    public void start() {
        if(current != null){
            current.show();
            return;
        }


        Form hi = new Form("Hi World", new BorderLayout());
        hi.add(BorderLayout.CENTER, new Label("Hi World"));

        Command cmd1Command = new Command("CMD-1", 1);
        Command cmd2Command = new Command("CMD-2", 2);
        hi.addCommand(cmd1Command);
        hi.addCommand(cmd2Command);
        hi.addCommandListener(this);

        hi.show();
    }

    public void stop() {
        current = getCurrentForm();
        if(current instanceof Dialog) {
            ((Dialog)current).dispose();
            current = getCurrentForm();
        }
    }

    public void destroy() {
    }

    public void actionPerformed(ActionEvent actionEvent) {
        Command command = actionEvent.getCommand();

        Dialog.show("Dialog", "Received=" + command, "OK", "Cancel");
    }
}
@shannah
Copy link
Collaborator

shannah commented Sep 26, 2018

I've reproduced the issue. Looking into it.

@shannah shannah self-assigned this Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants