So, no way to edit a post? That's fun. Anyway, wanted to clarify that in
the screenshot I added a second field not shown in the sample code just so
I could change focus more easily. It's irrelevant really but didn't want
someone to get hung up on it.
On Friday, April 20, 2018 at 7:29:17 PM UTC-7, Paul Wade wrote:
>
> Attached an screenshot of how the selected field looks when the form loads
> initially. The cursor isn't visible but it's in the first field.
>
> On Friday, April 20, 2018 at 7:24:05 PM UTC-7, Paul Wade wrote:
>>
>> 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/59b335d0-abbe-40cf-a2bf-47c0945b58bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.