Step 1 Create a Simple List

Visual LANSA

Step 1. Create a Simple List

FRM055 - List Component Basics

In this step you will begin by creating a simple form containing a combo box containing a list of all departments. A combo box (or drop down), is a simple list component which displays one column with one entry visible. The list may be expanded by clicking the drop down button .

When you select a department its details (DEPTMENT and DEPTDESC) will be displayed on the form.

1.  Create a New Form / Basic Form iiiListBasics – List Basics (where iii are your course assigned initials).

2.  Drag a Group Box onto the top of the form from the Controls tab, resize it and set its Caption to Location. Your form should look like the following:

3.  Drop a Combo Box onto the Group Box. Extend its length to approximately half the form width. Change its Name to DEPTS. Move the Combo Box towards the bottom edge of the Group Box. Remember as well as dragging with the mouse, you can move components by holding down the Control key and using the cursor keys.

4.  Drop a Label component above the Combo Box, resize it and change its Caption to Department. Your form should look like the following:

 

5.  Display the Source tab.You will see DEFINE_COM like the following:

Define_Com Class(#PRIM_GPBX) Name(#GPBX_1) Caption('Location') Displayposition(1) Height(78) Left(3) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(3) Width(454)
Define_Com Class(#PRIM_CMBX) Name(#DEPTS) Componentversion(1) Displayposition(1) Height(18) Left(20) Parent(#GPBX_1) Showselection(False) Showselectionhilight(False) Tabposition(1) Top(43) Width(165)

 

     Note the combo box DEPTS has a parent of GPBX_1. The group box is a "container". The combo box DEPTS belongs to this container.

6.  Add columns to the DEPTS Combo Box. A combo box displays one column, but may contain other hidden columns.

a.  Drop field DEPTMENT into the combo box and use the Details tab to set its Visible property to False. To do this, select the component CBCL_1 from the drop down at the top of the Details tab. You are then working with the first column component for the combo box DEPTS.

b.  Drop the field DEPTDESC into the DEPTS combo box.

     Your form should now look like the following:

7.  Display the Source tab. You will see new DEFINE_COM statements for the columns, like the following:

Define_Com Class(#PRIM_CBCL) Name(#CBCL_1) Parent(#DEPTS) Source(#DEPTMENT) Visible(False)
Define_Com Class(#PRIM_CBCL) Name(#CBCL_2) Displayposition(1) Parent(#DEPTS) Source(#DEPTDESC)
 

     The Combo Box columns are automatically named. They have a parent of DEPTS. The columns belong to the combo box DEPTS.

     They have a Source property, DEPTMENT, for example, meaning the column is based on field DEPTMENT.

8.  Drop fields DEPTMENT and DEPTDESC onto the form below the Group Box. Lengthen the form first if necessary. Your form should look like the following: