I need to update text color.
I have set up a style with the updated text color but I have no idea how to change the style in code. WebTextField1.Style.Name = “RedTextStyle” didn’t work.
I need to update text color.
I have set up a style with the updated text color but I have no idea how to change the style in code. WebTextField1.Style.Name = “RedTextStyle” didn’t work.
WebTextField.Style = RedTextFile
That worked! Thanks!
I was afraid I would have to figure out how to use a Thread and/or a Task.
HI,
In addition to this post:
I have a situation where a customer can choose the color by colorpicker and save it as usersettngs.
The next time the user enters the login, the colorvalue is read-out and used for textcolor.
Because of the many combinations of rgb i can’t predefine styles for each color and switch between styles.
So I will change a style property.
Is there a way to do something like this:
(changing property in existing style)
[b]SavedColorStyle.TextColor[/b] = rgb(229,178,0)
WebTextField.Style = SavedColorStyle
for this example I used rgb function instead of loading the color from database.
Best regards,
Marc
[quote=118115:@Marc van Buel]HI,
In addition to this post:
I have a situation where a customer can choose the color by colorpicker and save it as usersettngs.
The next time the user enters the login, the colorvalue is read-out and used for textcolor.
Because of the many combinations of rgb i can’t predefine styles for each color and switch between styles.
So I will change a style property.
Is there a way to do something like this:
(changing property in existing style)
[b]SavedColorStyle.TextColor[/b] = rgb(229,178,0)
WebTextField.Style = SavedColorStyle
for this example I used rgb function instead of loading the color from database.
[/quote]
If you tried, you probably got an error. WebStyles do not work that way. You want to read
But you can set the color of a particular control type such as a TextField.
Add this to App.HTMLHeader :
input[type="text"] { background-color: transparent ; color: rgb(229,178,0)}All TextFields become transparent and text color is brownish (your specs). Of course, you do not want to apply a Xojo style, it would ruin it. Unless you want a particular TextField another color.
If you want a control where you can change text color on the fly, look into WebSDK, in the Extras folder next to the Xojo executable.
Ok. Thanks . I Have to look into WebSDK.
Because after login, I know what color is needed. The App.HTMLheader is set before. The color must be changeable during the runtime and after loginpage.
Thanks to Michel
[quote=118751:@Marc van Buel]Ok. Thanks . I Have to look into WebSDK.
Because after login, I know what color is needed. The App.HTMLheader is set before. The color must be changeable during the runtime and after loginpage.[/quote]
The method works also in a Page Source so you can use it on a WebPage basis. BUT the source property of a Page Source can only be set at design time. So the problem remains.
Indeed the best way is to use a WebControlWrapper around an editfield so you can ExecuteJavaScript on it to change the text color.
See http://stackoverflow.com/questions/2173229/how-do-i-write-a-rgb-color-value-in-javascript
and
http://stackoverflow.com/questions/2516784/change-text-color-in-text-field