8 12 2 FOR Examples

LANSA Technical

8.12.2 FOR Examples

Columns Collection

This example loops through the columns of a list view and retrieves the DisplayPosition and Width attributes of the columns to a grid:

For Each(#Current) In(#ltvw_1.Columns)
Set Com(#STD_NUM) Value(#current.displayposition)
Set Com(#std_amnt) Value(#current.width)
Add_Entry To_List(#GRID_1)
Endfor
 

ComponentMembers Collection

This example records all the member components on a form and lists them in a grid:

For Each(#Current) In(#COM_OWNER.ComponentMembers)
Change Field(#STD_NAME) To('#CURRENT.NAME')
Add_Entry To_List(#GRID_1)
Endfor
 

ComponentForms Collection

This example loops through the collection of all forms currently realized by an application and records them in a grid:

For Each(#Current) In(#SYS_APPLN.ComponentForms)
Change Field(#STD_NAME) To('#CURRENT.ComponentTypeName')
Add_Entry To_List(#GRID_1)
Endfor
 

Items Collection

In this example clicking #PHBN_1 disables all the menu items in submenu #SMNU_1 and clicking #PHBN_2 enables the menu items:

Evtroutine Handling(#PHBN_1.Click)
For Each(#Current) In(#smnu_1.Items)
Set Com(#Current) Enabled(False)
Endfor
Endroutine
 
Evtroutine Handling(#PHBN_2.Click)
For Each(#Current) In(#smnu_1.Items)
Set Com(#Current) Enabled(True)
Endfor
Endroutine