Is there a way to change the fontsize in a webstyle via code…?
I have a text that need to change according to the background picture… (i.e. a gravestone, differs in size and color)
How can I change; size, color and font) in runtime via code…
I have now started making a lot of webstyles… but I would like to only use one, and change the parameters of that webstyle, and apply it to my text.
I found that webCustomcontrols from taylorDesign, has a WebStyleTD and WebStyleExt example, and here I can change size in runtime…
is this the only solution ?
[quote=280870:@Helge Tjelta]I found that webCustomcontrols from taylorDesign, has a WebStyleTD and WebStyleExt example, and here I can change size in runtime…
is this the only solution ?[/quote]
JavaScript. That is what I do in RubberViewsWE.
I keep finding these posts…and they are usually years old. Seems like an odd limitation to still exists. If I have say 30 text labels and they all have a webStyle called “yellowbold” – when somebody clicks a button I can change all their webstyles to “bluebold”.
It seems that somehow have to reassign the web styles of 30 controls triggered by the button click.
If I could assign webstyle properties at run time, I could could create a single webstyle called mystyle and simply set the color value in the button click event.
E.G.
mystyle.ForeColor = RGB(255, 255, 0, 0) or mystyle.ForeColor = &cFFFF00FF
mystyle.TextAllignment = WebStyle.TextAllignment.Center
mystyle.FontStyle = WebStyle.FontStyle.Bold
Doesn’t this seem like a natural Xojo-like way to accomplish this? Rather than embedded JavaScript or other?
WebStyles are compiled to static CSS, so this would probably be more work for Xojo than it’s worth. I would probably tackle this by writing JavaScript to change the style of existing elements that have the WebStyle name as a class.
I thought of another possibility that also doesn’t currently work that might(?) be easier for Xojo Developers to implement maybe (?)
If I could set one style equal to another style.
Dim MyStyle as new WebStyle
MyStyle = bluebold
I would create all the styles in advance…but just need to be able to assign WebStyles to a variable of type WebStyle(?) by reference.
Think that would work?
Oh, I did certainly try it first. Didn’t work. Not sure If I could do something sneaky with pointer-type addressing…but I can say that currently, you can’t use assignments on a WebStyle. I was thinking maybe the Xojo Dev team could do something kinda sneaky like that to support the ability to change a style at design time. If all my controls had the style called MyStyle and I could re-assign that one object to the address of a different object… I might be able to change the style of multiple controls en masse without technically updating generated static CSS.
I wonder if Web 2.00 would not be able to address that in a more elegant fashion. From what I understand, CSS support should be extended.