I have a WebApp with a Rectangle in 100x100 Pixel.
This Rectangle is black.
When a user is pressed a button, I want to change the color of the Rectangle from black to red.
I would use in the Action Event of the button something like:
.ForeColor = &cff0000
.FillRect = &cff0000
But I can’t access to the Rectangle.graphics?
oh? That was easy.
Using WebStyles every day, but didn’t get the idea in this moment. Thank you!
Hmm, is there a possibility to change the background-color of a style on the fly?
I don’t know the color at compile time of the app.
In that moment the user clicks on the button, I know the color.
Is there something like
Stylename.Backgroundcolor = … ?
I think I need something like this:
Stylename.Backgroundcolor= rgb(229,178,0)
Rectangle.Style = Stylename.Backgroundcolor
You should leave behind the habits from desktop.
Instead of changing the background color, use just another webstyle. You can change webstyle on the fly.
Sub Action()
if Rectangle1.Style = Green then
Rectangle1.style = red
else
Rectangle1.style = Green
end if
End Sub
Note that what you want to do is possible if you manage this in JavaScript :
object.style.backgroundColor=“#00FF00”
But if all you need is a couple of colors, Webstyles are simpler.