Dynamic Styles

LANSA Version 13 SP2

Dynamic Styles


Unlike Visual Styles which simply overwrite any existing style information when applied to a control, Dynamic Styles can be added and removed at runtime. This makes them akin to Cascading Style Sheets:

 

Dynamic Styles can be created as part of a Visual Style and accessed as read only features:

 

Define_Com Class(#prim_vs.Style) Name(#LargeFonts) Bold(True) Fontsize(72)

 

#Panel.Style <= #MyStyles<LargeFonts>

 

 

Alternatively they can be created at runtime in the same as any other component instance and then applied to controls as required. Styles created this way are entirely dynamic and can be modified at runtime to reflect user preferences:

Define_Com Class(#prim_vs.Style) Name(#Fontsize) Fontsize(10)

 

Evtroutine Handling(#Fontsize.Changed)

#DynamicStyle.FontSize := #FontSize

Endroutine

 

Multiple styles can be added or removed from a control:

Evtroutine Handling(#...)

#Control.Styles.Add(#MyStyles<LargeFonts>)

#Control.Styles.Add(#MyStyles<UnderlineItalic>)

Endroutine

 

You can use dynamic styles to define rounded corners, borders top, left, right or bottom, effects e.g. drop shadows, foreground and background brushes and opacity masks.

Styles can be applied at Application level to alter the appearance of all controls:

Define_Com Class(#prim_vs.Style) Name(#Label) Cornerbottomleft(3) Cornerbottomright(3) Cornertopleft(3) Cornertopright(3)

Evtroutine Handling(#Com_owner.Createinstance)

#Sys_Appln.Appearance.Label <= #Label

Endroutine