B4J Question Switch background image to color?

techknight

Well-Known Member
Licensed User
Longtime User
I am working with Panes, and i can successfully set a background image on the Pane using CSSUTILS.

Works fine, but if i want to switch back to a color, it wont let me. Not sure how to fix it:

1631115241405.png


Thoughts?
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
i guess the image is super posing the color, remove the key that was created for the image. you can get the keys with:
RootPane.Style
and remove it with
CSSUtils.SetStyleProperty
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
I tried this:

B4X:
CSSUtils.SetStyleProperty(pnlScoreboard, "fx-background-image", "")

but it glitches out sometimes, and you get this error:
WARNING: CSS Error parsing '*{-fx-border-color:#000000;
-fx-border-width:0.00;-fx-background-image:;-fx-background-size:stretch;-fx-background-color:rgba(0,255,78,1.00);-fx-background-image:;fx-background-image:;-fx-background-image:;-fx-background-image:;-fx-background-image:;-fx-background-image:;-fx-background-image:url(jar:file:/C:/B4J/tempjars/AsyncInput2!/Files/background.png);}: Unexpected token ';' at [2,221]

so it keeps adding to it, but not really clearing it out.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
1. You will never see Pane in my code. Only B4XView.
2. Better to use ImageView or B4XImageView to show the image. B4XImageView will provide many useful features.

Yeah i should have thought of that before i built the entire UI with the pane as the parent, since switching parents to another view will screw all the X/Y positions. Now i could sandwich another control in between and make the pane transparent, would be an easier option
 
Upvote 0
Top