Skip to content

Picker/Interaction dialog doesn't appear when using desktop skin in simulator #3860

@shannah

Description

@shannah

Example app:

package ca.weblite.datespinnerbug;

import static com.codename1.ui.CN.*;

import com.codename1.system.Lifecycle;
import com.codename1.ui.*;
import com.codename1.ui.spinner.Picker;
import com.codename1.ui.layouts.BoxLayout;

import java.util.Calendar;
import java.util.Date;

/**
 * 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 DateSpinnerBug extends Lifecycle {
    @Override
    public void runApp() {

        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, 2000);
        cal.set(Calendar.MONTH, 6);
        cal.set(Calendar.DATE, 31);

        Picker datePicker = new Picker();
        datePicker.setType(Display.PICKER_TYPE_DATE);
        datePicker.setStartDate(cal.getTime());
        datePicker.setEndDate(new Date());
        datePicker.setUseLightweightPopup(true);

        Picker stringPicker = new Picker();
        stringPicker.setType(Display.PICKER_TYPE_STRINGS);
        stringPicker.setStrings("A", "B", "C", "D");

        Form hi = new Form("Hi World", BoxLayout.y());
        Button helloButton = new Button("Hello World");
        hi.add(helloButton);
        hi.add(datePicker);
        hi.add(stringPicker);
        helloButton.addActionListener(e -> hello());
        hi.getToolbar().addMaterialCommandToSideMenu("Hello Command",
        FontImage.MATERIAL_CHECK, 4, e -> hello());
        hi.show();
    }

    private void hello() {
        Dialog.show("Hello Codename One", "Welcome to Codename One", "OK", null);
    }

}

When clicking on either the date picker or string picker, in the simulator with the desktop skin, the dialog does not display. It works with both the iPhone skin, and iPad skin.

Initial investigation shows that the components are added to the form okay, but they have zero or negative widths.

Looking through the git blame in code path I don't see anything recent, so this bug has been around for a while.

Testing on Windows 11, Maven, Simulator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions