Runtime Styles

Visual LANSA

Runtime Styles

For most scenarios, predefined styles stored in the repository will cover application requirements. However, there are situations where dynamic styles are required, for example for font or color selection. In these situations, Styles can be defined and instances created just like any other component, meaning their properties can be set at runtime.

The following shows a color picker dialog when the form is clicked. The selected color is applied to the style and thus to the background of the form:

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_Form) Clientheight(284) Clientwidth(464) Height(322) Left(126) Style(#Style) Top(223) Width(480)
Define_Com Class(#prim_vs.Style) Name(#Style) Normbackcolor(White)
Define_Com Class(#Prim_appl.ICommonDialogColor) Name(#ColorPicker) Reference(*dynamic)
Evtroutine Handling(#Com_owner.CreateInstance)
#Com_owner.Cursor <= #sys_appln.Cursors<Hand>
Endroutine
Evtroutine Handling(#Com_owner.Click)
Define_Com Class(#prim_boln) Name(#OK)
If (#ColorPicker *Is *null)
#ColorPicker <= #sys_appln.CreateColorDialog
#ColorPicker.FullyOpen := true
Endif
 

Ý 6.29.2 DirectX Styles