How to set the font for Text field hint when selected - codenameone

I have used text field with hint "Phone Number". When I click on the text field the text "Phone Number" font will be increased automatically. I'm wondering is there any way I can control the size of the font when =text field control is in focus or selected. Please advise.
Code:
TextField num = new TextField("", "Phone Number", 10, TextField.PHONENUMBER);
Thanks

You need to style both the selected and unselected versions of the UIID in a consistent way. You can do that in the Codename One designer tool by editing the style you overrode and making sure both Selected and Unselected tabs have the same value for the font.

Related

How do I change the combobox icon in fluent-ui select field?

I am using fluent-ui. I want to change the given Combobox icon to a different font icon. How to achieve this?
link: https://developer.microsoft.com/en-us/fluentui#/controls/web/combobox
Thanks so much

Change span label font size in codenameone

I want to show a multiline text so I use a span label. I am trying to set the font size from the gui but it does not change.
I also trying to set the color dynamicaly using the next code:
this.gui_Span_Info.getAllStyles().setFgColor(HTMLElement.COLOR_RED);
but nothing happens.
What should I do?
SpanLabel is a composite component which means it's built from 2 or more separate components one of which is a Container.
You can determine the UIID of the text using setTextUIID it defaults to the Label UIID.

Textfield's content disappears during typing

I've got an issue with the textfield : the content disappears 1 sec after typing and it's displayed normally when I unfocus the textfield.
It's occurs only on Android, not in the simulator.
Thank you & merry christmas !
Check that the selected style for the text field wasn't manipulated in any way so the colors make it appear transparent.

Trouble changing background color of TextField in Codename One

I just started building my first App with Codename One and I'm having quite some trouble. :-)
I cant change the background color of a TextField, I changed everything in the Theme and named it "TextField". At the Color tab I changed the background color and set Transparency to 255. Since the Component is named TextField, shouldnt the style be applied automatically when I make a new TextField?
I also tried to set the UIID manually to "TextField", which didn't help either.
Am I missing something?
Kind regards,
Max
The way backgrounds work in Codename One is this:
Border is applied first
Then image
Then gradient
Then color
TextField and other components such as Button etc. often have a default border derived from the theme.
Switch to the Border tab, click derive then click the ... button and select empty.

SWT Combo with only dropdown arrow shown

I am looking for a SWT Combo where only dropdown arrow is shown in order to save space.
I found that setting a GridData.widthHint to the width of the arrow icon on the Combo might do the trick.
The question is how do I ask the Combo layout the exact width of the down arrow on the Combo so that I can set that as the widthHint?
Update:
Looks like even setting the widthHint = 0 still shows part of the text field. So any other ideas would be welcome.
I don't see a way to get the drop down button width. Messing around with the width hint is likely to be very platform dependent.
An alternative would be to use code similar to the CCombo control but without the Text field. This uses a Button with the SWT.ARROW | SWT.DOWN style:
Button button = new Button(parent, SWT.ARROW | SWT.DOWN);
When the button is pressed an SWT List control is displayed.

Resources