How to close a TextField numeric keyboard on iOS after editing? - codenameone

I would like to edit a numeric decimal value like 21.7 and enable the user to close the numeric keyboard (iOS 13.3.1, iPhone Xr) when done.
I'm using a numeric text field (TextField with constraint TextArea.DECIMAL). I've NOT set the option putClientProperty("iosHideToolbar", Boolean.TURE) for the TextField. However, there is no keyboard Done option, so the user cannot close the keyboard after entering the value.
I've gone through the documentation (https://www.codenameone.com/manual/components.html) and as I understood it, using tf.putClientProperty("iosHideToolbar", Boolean.TRUE); would hide the toolbar, so since I'm NOT setting the property, I assume the toolbar and the Done button should be available.
Any advice on how to get the Done button (or other ways to getting rid of the numeric keyboard)?

In the action listener for the text field you can just invoke stopEditing() on the text field. You can use either the standard action listener or the done listener for this purpose.

I would like to edit a numeric decimal value like 21.7 and enable the
user to close the numeric keyboard (iOS 13.3.1, iPhone Xr) when done.
I'm using a numeric text field (TextField with constraint
TextArea.DECIMAL). I've NOT set the option
putClientProperty("iosHideToolbar", Boolean.TURE) for the TextField.
However, there is no keyboard Done option, so the user cannot close
the keyboard after entering the value.
Are you sure?
I tried the following code on iOS 13 (iPhone X):
Form hi = new Form("Example", BoxLayout.y());
hi.add("Enter a decimal value:");
TextField textField = new TextField();
textField.setConstraint(TextArea.DECIMAL);
hi.add(textField);
hi.add(new Button("Submit"));
hi.show();
Result:
As you can see, this sample code produces the "Done" button on iOS. So, if your app doesn't show it, maybe the cause of the issue is elsewhere.
I just noticed that there is no Done button shown for a multi-line
TextField with normal text
I tried:
Form hi = new Form("Example", BoxLayout.y());
hi.add("Enter a multiline text:");
TextArea textField = new TextArea("", 3, 80);
textField.setConstraint(TextArea.ANY);
hi.add(textField);
hi.add(new Button("Submit"));
hi.show();
Result:
Also in this case, there is the "Done" button.
Currently, as far as I know, the "Done" button is not shown in the iOS virtual keyboard toolbar if it's already included in the keyboard itself, for example in the case of a generic TextField without a "next" TextField. I mean like in the following screenshot (note that the blue key "fine" is the Italian equivalent of "Done"):
So, I don't know how to help you. Try to update your question (or try to open a new one) adding a self-enclosed test case that reproduces your issue.

Related

How to add checklist on my notes app in the writing area

So, I am making a note taking app with react, and I want to make something that works like apple notes where you can click on the checkbox and it adds a new checkbox to the writing area.It keeps adding a new one when you press return/enter until you press backspace, and then you can resume typing regular text. I've been trying to do it yesterday pretty much the whole day, I found some rich editor text libraries but even though they have functionality to style the text e.g bold, italic etc. I cannot find a library that provides this specific functionality. I tried using a div with the contentEditable attribute instead of textarea but I wasn't sure what to do.
In case my explanation was bad here is an image.

How to enable two components layed out with LayeredLayout to both receive events?

I'm using a LayeredLayout to overlay a TextArea with a small button in the upper right-hand corner of the TextArea (the button is used to insert a time-stamp to easily date the manual text entries).
I want the small button to receive the events when the user 'clicks' on it and at also allow the user to click in the TextArea below to edit the text manually. However, when I use LayeredLayout, only that last added component will receive the events. Meaning either only the textArea is active and the small button cannot be pushed, or the button can be pushed, but the user cannot click the TextArea to initiate the edit. Hope the description is clear enough to understand.
As far as I could see, none of the other existing Layouts lends themselves to this case. Is there a way to achieve this?
Thanks in advance for any ideas or suggestions.
Both receive events when clicked, we use this pattern often. I'm assuming you tried to push the button while you were editing which is problematic since editing delegates pointer events to the native OS editing code.
See:
Form current = new Form("TextAreaButton", BoxLayout.y());
TextArea ta = new TextArea("Text of Text Area");
ta.addActionListener(e -> Log.p("Text is: " + ta.getText()));
Button b = new Button("");
b.addActionListener(e -> ta.setText(""));
FontImage.setMaterialIcon(b, FontImage.MATERIAL_CLEAR);
current.add(
LayeredLayout.encloseIn(ta,
BorderLayout.east(b))
);
current.show();

Codename One - TextField appearance

I have a GUI built app and am trying to emulate the TextFIeld look of the Yahoo Mail page, where the underline of the TextField turns to blue when pressed.
I changed the "pressed" and "selected" state of the TextField UIID, but it only changes when I press it, but it doesn't stay that way and it turns back to grey.
Question:
Is there some kind of "toggle" function in TextFields as in CheckBoxes, so the new state stays that way?
Only selected state is used in text field (not pressed) and it should remain blue. It seems this is an issue with Codename One possibly a recent regression due to recent changes to text editing.
I've filed an issue on that here.

Mobile command button issue

In the iPhone ADF mobile app I have a textinput field and a "Save" commandbutton. In the properties for the commandbutton I have the disabled condition set (like if the textinput field is null). This works fine. In the beginning the save button is disabled and when I enter any text with a keyboard the button is automatically enabled and vice versa.
The only issue is my users can enter the text via voice too. If they use the voice to fill the text field - still the save button is not enabled. As soon as they change anything using key board it is enabled.
How do I set the command button properties to check this please?
In the InputText properties there is a property called Value Change Listener,
add a java method to it to check if the value is null or not then try one of the below:
Reset the InputText value as this will fire the propertyChangeListner and may activate your button.
Disable or Enable your button in code according to the value.
Hope this help.

Selenium 2 webdriver and jQuery calendar

I give input the to a input field which has a jquery ui calendar
id("dateSelecterInput").sendKeys(date);
id("dateSelecterSubmit").click();
When you enter something in a input field the calendar pops up, as it should, but when then cover the submit button which is below the input field. The problem is that for Webdriver it cant click the submit button, probably since its not visible ?!?
The problem can be solved be clicking a other element, but its a hack, how to solve it proper?
We use date pickers all over our production site . After clearing the date field and sending keys, can't you press the return key to get the same result , instead of clicking on the button?
if pressing return is not an option, then , yeah, modify your css so that the button is always visible. selenium works the same way an end user would see the site, so.

Resources