Designs

Visual LANSA

Designs

The visual design and the control need to interact. This means that such features as selection or focus appearance, which are built-in in predefined controls, need to be coded for user-designed controls. 

To interact with the control the design needs to implement an interface:

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #XDXBasePanel *Implements #Prim_Tile.iTileDesign *ListFields #ListFields) Height(60) Layoutmanager(#Layout) Mouseoverstyle(#XDXStyles<MouseOver>) Style(#XDXStyles<Item>) Width(248)

* Fields received as on Add_entry
Group_By Name(#ListFields) Fields(#Empno #Surname #Givename #Deptment #Section #Deptdesc #Secdesc)
 

The *ListFields parameter, which can also be added to the Begin_Com, defines the fields that will act as the underlying data for the list.  The control passes the specified fields into the design instance at the moment an Add_Entry command is executed.

For each of the events that can happen to a design, there is an equivalent OnXxxxx method on the interface that can be redefined within the design.  This allows control to be passed to the design instance by the parent control.  In this way, when the design is created by the use of Add_Entry, the OnAdd method is executed:

Mthroutine Name(OnAdd) Options(*Redefine)
#lEmployee := ("&1 &2 (&3)").Substitute( #GiveName #Surname #Empno )
#lDepartment := ("&1 (&2)").Substitute( #Deptdesc #Deptment )
#lSection := ("&1 (&2)").Substitute( #Secdesc #Section )
Endroutine
 

Similarly, to manage focus being set, it is necessary to add a style to show focus, and when the item is no longer focus, the style needs to be removed:

Mthroutine Name(OnItemGotFocus) Options(*Redefine)
#Com_self.Styles.Add( #XDXStyles<Focus> )
Endroutine
Mthroutine Name(OnItemLostFocus) Options(*Redefine)
#Com_self.Styles.Remove( #XDXStyles<Focus> )
Endroutine

 

Each individual user-designed control has its own interface.  Most have similar methods for add, delete, focus and selection.  Only tree is different because it also provides methods for expanding and collapsing items.

Refer to the Feature help (F1) for information about user-designed control properties, methods and events.