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.
Related
We're using the component for a search field. When entering something into the field an "x" clear button appears. I can't figure out how to change the color of this button. We're not using an icon button or anything like that, and if I try to inspect the clear button it I can't find it in the dom, only the input field is shown selected.
I've understood that the normal approach to adding a clear button is to use inputAdornment. We are using inputAdornment for a progress indicator, but I can't find anything in our code for the clear button, so wondering if this is something default and how to go about changing it, or at least get a reference to it so I can use css to style it. Any help appreciated!
On a Codename One lightweight date pickers, the user has four buttons in the top, like in the following screenshot.
I suppose the tapping of the second, third and fourth buttons are detected by the .addActionListener() (please correct me if I'm wrong)... but I need to detected also the tapping of the "Cancel" button. How can I run some code when the user taps "Cancel"?
We don't provide a way to detect cancel since we can't consistently detect it on native. As a workaround you can listen to the click on the picker button and unless you get a selection it would mean that the action was canceled.
Alternatively we can add a feature like this for the lightweight picker only. If you need that you can file an RFE on that.
I overcame this by comparing the newly selected picker value to the previously stored value. If it’s the same, I consider it a cancel.
Using CodenameOne,
I have a Form that the user needs to fill in. All of the components, however, are actually Containers that represent custom functionality. As an example, I would have a TextField alongside a Button on a Container, and I would use that Container as a "Component". This allows me to create more advanced functionality by combining existing Components.
A good example of where this is necessary is that of a custom date entry field existing out of 3 TextFields or a combination of TextFields and ComboBoxes.
I have a "Field" that has functionality for that of a Contact Component.
This all serves as a single "Unit" in order to allow the user to choose a contact or fill in their own. Buttons open Dialog popups, etc.
My problems comes with when the user uses the Android keyboard. Should this Contact Object be the second "Field" and the user presses the 'Next' button on the Android keyboard, the App does not know what field to give focus.
Furthermore, If one of the fields are a ComboBox or a Button and the user presses next to reach that Component, the keyboard doesn't close, and instead removes the 'Next' button, replacing it with a return button or an emoticon selector.
Below is an example situation:
The user would press on the first field, the Keyboard shows up, and when the user presses next, the keyboard's Next button dissapears, as the immediate next field happens to be a Button or ComboBox.
Is there a way to change the focusing index, or omit certain fields form ever gaining focus in this way? I tried making the entire thing a Component but that doesnt allow me to combine other Components. Even if it is possible to make the parent Container a Component, how would I solve this particular issue?
The default behavior is to use the "next focus down" for this functionality so just use setNextFocusDown(nextTextField) on each one of the components. Notice that a ComboBox won't work as expected although you might want to change that to an AutoCompleteTextField which would.
I'm not sure if this is a bug or just something I'm missing.
I've added 2 multi-images to the constants "RadioSelectedImage" and "RadioUnselectedImage", and they work fine except in their pressed state. For example: the custom image I added to the unselected constant appears just fine in my RadioButton before any interaction, but when I press it, the image changes to the native image, and when I release it, it changes to my custom selected image as expected.
I thought the problem was with RadioButton's pressed UIID, but I don't see anything that could be changing its image. I'm deriving everything in the pressed state from the unselected state.
Furthermore, if I set the constant "IncludeNativeBool" to false, then it all works as expected, and my custom image appears even in the pressed state. I'd rather not do that though, since I rely on the native theme for some components in my app.
Am I missing something here or is this a bug? If it's the latter, is there a workaround?
It should be radioSelectedImage, radioUnselectedImage, radioSelectedFocusImage & radioUnselectedFocusImage.
I need a search field component but i don't find such a component or a imeoption for text field to make it as search field. i search a lot but still nothing founded.
is there any way to do that?
Thanks in advance.
What do you mean by "search field"?
There is a DataChangeListener that allows you to track fine grained changes to the TextField. You can set a hint & hint icon to show that this is a search field. Its unclear what you are missing.
Edit based on comments:
To get the magnifying glass icon instead of Done button on Android you can use the somewhat undocumented flag:
textCmp.putClientProperty("searchField", Boolean.TRUE);
This is a done event, so you can distinguish pressing this from pressing outside of the field by using the done listener callback on the text component.