Is there a way to set the font size in the Open event of WebTextArea and WebTextField without using a WebStyle?
The controls are being created dynamically and the font size varies from one to another. Using works for a WebLabel but not WebTextArea and WebTextField.
[quote=350938:@Michel Bujardet]OK, folks, setting the font size in code simply does not work. I tried to add the now ubiquitous !important to no avail.
I give up. It is possible to change color, font family, but NOT font size…[/quote]
That’s very bad news. When dynamically adding controls to a web page, is there any way to change the font size, especially when the sizes are not known at the time the app is developed and compiled? Perhaps @Greg O’Lone can provide some guidance . . .
I just tried this on Safari, Firefox and Chrome and it does work… but 14px is really close to the default size. You may not be noticing the change. Try “6px” instead.
NOTE: I did change me.ControlID to TextArea1.ControlID just to be specific about it.
BIG NOTE: Directly modifying the DOM is a great way to shoot yourself in the foot…
Is there a safer way to set the font size when the value is not known until runtime?[/quote]
Not unless you want to create a style for every size. Just be aware that we make changes to the framework over time and calling ExecuteJavascript to directly manipulate the DOM tends to be the thing that breaks. We dont do it to intentionally break projects, but theres just no way for us to avoid all of the hacks that anyone has applied ever.
I’m really curious about the use-case though… what is it that you are trying to accomplish that you need to be able to change the text size of an editable field on-the-fly?
I’m not sure what Fred’s case is, but in some of our projects we’ve let users to selected a color and assign it to a record type. In web, you have to create colors in advance and let the users pick from that list.
I have used the WebPageSource control to alter the CSS of existing styles when a page is opened. I have made a quick & dirty example and loaded it at:-
We are migrating a desktop app with a user defined interface. The users specify the types of controls, their placement, their size, their font, their font size, etc. The app creates the interface on the fly. Once created, none of the attributes need to be changed. So we need to set the font size upon creation of the control but not after its been placed on a page.
There are so many properties not editable with the style edtor included in the IDE.
Many other properties can’t be overridden at runtime using or not the !important clause.
[quote=351053:@Chris Carter]I have used the WebPageSource control to alter the CSS of existing styles when a page is opened. I have made a quick & dirty example and loaded it at:-
[quote=351053:@Chris Carter]I have used the WebPageSource control to alter the CSS of existing styles when a page is opened. I have made a quick & dirty example and loaded it at:-