I'm using Intellij IDEA. When run in the simulator the behavior of the
text component in the following code is not correct. The hint does not
move into the label position when the form loads. The label position
remains blank until the field loses focus and then regains focus the second
time. On the second and subsequent focus event the label functions as
expected.
However, if I comment out either the button being added to the container or
the setEditOnShow() line then it works correctly. I'm presuming I'm doing
something wrong here because it seems to work fine on an Android device.
Btw, this is cut from a much larger form just to reproduce the issue. I
thought perhaps the TextModeLayout was causing the problem with adding the
button but even if I move the button outside of the container to
BorderLayout.SOUTH the same issue persists. What am I doing wrong?
private void showTestForm(Form parent) {
Form f = new Form("Edit Entry", new BorderLayout());
f.getToolbar().setBackCommand("Back", e -> parent.showBack());
TextModeLayout layout = new TextModeLayout(2, 1);
Container c = new Container(layout);
TextComponent meetingName = new TextComponent().labelAndHint("Meeting
Name");
c.add(layout.createConstraint().widthPercentage(100), meetingName);
Button saveButton = new Button("Save List");
c.add(layout.createConstraint().widthPercentage(100), saveButton);
f.add(BorderLayout.CENTER, c);
f.setEditOnShow(meetingName.getField());
f.show();
}
Enter code here...
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/a2728753-e3b0-4772-8256-2ffdc89b9503%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.