If you want to use Xojo WebStyles you would still create them at design time, but you could change their properties at run time. That frees you to treat styles as representing groups of controls (i.e. ButtonStyle, ListBoxStyle) or logical presentation (i.e. HeaderLarge) rather then a million style variations.
WebStyleTD objects are created at run time.
It’s up to you. If you apply a specific WebStyleTD instance to controls in multiple sessions, then yes, changing its properties affects all sessions. But you don’t have to do this. If each session has its own set of WebStyleTD instances then changes would not propagate across sessions.
Changing a Xojo WebStyle called cssWebStyleExtDemo using the convenience methods:
cssWebStyleExtDemo.FontFamilyTD(strFontFamily)
cssWebStyleExtDemo.FontSizeTD(cnFontSize.Text)
cssWebStyleExtDemo.TextAlignTD(cnTextAlign.Text)
Changing CSS properties by name:
cssWebStyleExtDemo.StyleValueTD("background-image", "url('http://webcustomcontrols.com/images/lgrey011.jpg')")
cssWebStyleExtDemo.StyleValueTD("background-repeat", "repeat")
Changing a WebLabel directly:
cnDirectTest.FontFamilyTD(strFontFamily)
cnDirectTest.FontSizeTD(cnFontSize.Text)
cnDirectTest.TextAlignTD(cnTextAlign.Text)
Creating a WebStyleTD and applying it to a control:
objStyle = New WebStyleTD
objStyle.Value("background-image", "url('https://farm4.staticflickr.com/3735/12899646313_ed56605f43.jpg')")
objStyle.AddToControl(cnImage)
WebStyleTD has numerous AddTo / RemoveFrom methods for applying the style to controls, parts of a list box, and toolbar items.
The convenience methods like FontFamilyTD can be called on WebStyle, WebStyleTD, and WebControl.
There are convenience methods and constants for setting text decoration (underline, strike through), and a convenience method for setting padding. But again, you can always use the value methods to explicitly set any CSS. Padding is one thing you could potentially run into problems with on some Xojo controls.
You can also initialize a WebStyleTD with CSS. Example:
objStyle = New WebStyleTD("border: 2px solid black; background-color: blue;")
objStyle.AddToControl(MyControl)
So you could, for example, define an initial look for a control in raw CSS; create a WebStyleTD object at run time from that CSS and apply to the control; then change the style as the user selects values from popups, color pickers, etc.