Assign Text Size to WebTextLabel

Hello,

It seems that the WebTextLabel does not support the TextSize properties. I do not wish to just create a Style and assign to the WebTextLabel as I find that too many styles are making my WebApp very messy.

I understand that I can use CSS as alternatives. Besides, CSS is there other alternatives?

In Xojo Web, text size, fonts, text color and alignment are done with WebStyles.

If you don’t want to create a WebStyle (which is CSS underneath), you can always use JavaScript to directly modify a control style.

http://www.w3schools.com/cssref/pr_font_font-size.asp

Hello Michel,

After further digging,
https://forum.xojo.com/28338-modify-directly-the-control-s-style-properties/0

it seems that I still need to assign a Style to the WebControl. Are you able to provide me a working example without using Style as a reference?

Thank you in advance.

Regards,
Alvin

If you really want to do elaborate stuff in Xojo Web, you want to learn JavaScript.

Sub Shown() Handles Shown self.ExecuteJavaScript("document.getElementById('"+me.controlId+"').getElementsByTagName('p')[0].style.fontSize='20px';") End Sub

Hello Michel,

Thank you for your kind effort, its greatly appreciated.

[quote=308551:@Michel Bujardet]If you really want to do elaborate stuff in Xojo Web, you want to learn JavaScript.

Sub Shown() Handles Shown self.ExecuteJavaScript("document.getElementById('"+me.controlId+"').getElementsByTagName('p')[0].style.fontSize='20px';") End Sub [/quote]
And you also want to remember that tweaks like this may break in the future if we change the framework.

Sorry, I forgot the customary warning.

FWIW for myself I rather use a Webstyle in such a case.