String pickers appear in reduced form

10 views
Skip to first unread message

P5music

unread,
Aug 14, 2020, 8:55:28 AM8/14/20
to CodenameOne Discussions
My app has a dialog that wants to show 4 string pickers with numbers as strings.
Code is like
        Picker stringPicker = new Picker();
        s
tringPicker.setType(Display.PICKER_TYPE_STRINGS);
        s
tringPicker.setName(pickerName);
       
String[] strings=new String[max];
       
for (int i=0;i<=max;i++) strings[i]=String.valueOf(i);
        s
tringPicker.setStrings(strings);
        stringPicker.setSelectedString(strings[0]);
        pickersArea.add(stringPicker);

As you can see in the attached images the pickers are in a certain layout that works, but I thought I woud see the real pickers, not just the current selection for each of them.

1-If I click on a picker the real picker appears in a separate dialog. Using the tab key or the provided up/down arrows it is possible to cycle through the pickers, but this is not the intended user experience.
How can I have the real pickers on the first dialog? On Android it is possible.

2-I need that the pickers have a label. Is there a method or I have to include the labels in the layout?
Thanks in advance

2020-08-14 14-43-33.png
2020-08-14 14-43-01.png

Shai Almog

unread,
Aug 15, 2020, 1:23:27 AM8/15/20
to CodenameOne Discussions
1. We don't currently expose the underlying API for the underlying picker UI. The main reason behind that is that pickers are sometimes implemented natively and this will cause some issues. We might expose the underlying lightweight picker implementation in a future update which will allow for more control.

2. You can just add a label next to a picker in the layout or you can use PickerComponent which is a sibling of TextComponent and works in the TextModeLayout system.

P5music

unread,
Aug 16, 2020, 9:10:35 AM8/16/20
to CodenameOne Discussions
I just created my own NumberPicker, as a Container. I can use it in the layout wherever I want.
Regards
Reply all
Reply to author
Forward
0 new messages