B4J Question Textfield background color

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All

Another Textfield problem. I have a textfield on a pane, both have the same colour [Green} assigned in the Visual Designer VD. When complied they show as different greens.
The RGB is the same the alpha is the same.

Anybody have a clue as to what I have done wrong?

Regards Roger

PS the pane should be hard in the top/left corner of the map but is offset. Another mystery?

 

Roycefer

Well-Known Member
Licensed User
Longtime User
As for the Pane being in the top-left corner, did you use anchors in the Visual Designer? Make sure that the parent Node of the Pane in question is the Node you think it is when setting the anchor.

As for the TextField background color, why not just make it white (or any other color, really) with maximum transparency? Then the underlying Pane's background color should show through.
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Roycefer,

Two good thoughts there but...
My first attempt was to select "Transparent" as the backround colour of the Textfield. The background colour turns to Blue when the Textfield is selected to enter text.
I have tried setting the colour to Green [or Pink, or Red] with the alpha set to zero, unfortunately the text disappears. Presumably it's alpha also goes to zero???

On the Top/Left issue attached is a SS of the Pane in the VD, perhaps you can see something I'm missing.

Regards Roger

 
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
Instead of setting the color in the Drawable/Color section of the Visual Designer, try adding "-fx-background-color:green;" (or whatever) to the TextField's ExtraCSS in Background Properties in the Visual Designer. That works for me.

For the Panel alignment, it looks correct. You have the anchors set to "TOP" and "LEFT" and the left/top distances are both set to 0. The parent Node is Main. By all rights, it should appear in the upper left corner. The only thing I can think of is to make sure you only have one variant of the layout (check the Variants tab). Are you doing any Designer Scripts?
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Roycefer

You solved the Top/Left issue, designer script, I had forgotten that I had done that early on. I feel like an idiot.

Currently I have -fx-padding: 0;" in the CSS to zero the padding. If I insert -fx-background-color:green; in it's place it works as expected.
If I try to use both parameters in CSS " -fx-padding: 0;"& "-fx-background-color:green;" it fails miserably.
Could you please give me a sample of the correct syntax for using multiple parameters in CSS.

Many Thanks Roger
 
Last edited:
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
It should just be a simple matter of using semi-colon-separated lines:
B4X:
-fx-padding:0;
-fx-background-color:chartreuse;

If that doesn't work, try reversing the order.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…