Using Styles

Visual LANSA

Using Styles

All controls have Style and Styles properties. The simplest application of a style follows:

Define_Com Class(#Prim_labl) name(#Heading) Caption('Details') Style(#MyStyles<Heading1>)

 

Multiple styles can be assigned to a single control at runtime by using the Styles property.

In this example, a label already has a style, but as a value changes, an 'error' style is added or removed as required:

Define_Com Class(#Prim_labl) name(#ValueCaption) Caption('Details') Style(#MyStyles<Emphasis>)
Evtroutine Handling(#Value.Changed)
If (#Value > #AllowedLimit)
#ValueCaption.Styles.Add(#MyStyles<Error>)
Else
#ValueCaption.Styles.Remove(#MyStyles<Error>)
Endif
Endroutine

 

Styles can also be applied at a global level, for example, when the application first starts. The styles are adopted by all forms and reusable parts.

This same concept also applies to individual controls. Following, the application is given a style, and an additional style is applied to all edit boxes to ensure that they all have rounded corners when first created:

Evtroutine Handling(#Com_owner.CreateInstance)
#sys_appln.Style <= #MyStyles<ApplicationStyle>
#sys_appln.Appearance.Edit <= #MyStyles<Edit>
Endroutine
 

Ý 6.29.2 DirectX Styles