Example 1: Simple table view

Figure: Form with simple table

Screenshot of form with table using two columns and image

The form file form.per:

LAYOUT
TABLE
{
[c1         |c2                                      ]
[c1         |c2                                      ]
[c1         |c2                                      ]
[c1         |c2                                      ]
}
END
END
ATTRIBUTES
PHANTOM FORMONLY.key;
c1 = FORMONLY.name, TITLE="Name", IMAGECOLUMN=image;
PHANTOM FORMONLY.image;
c2 = FORMONLY.detail, TITLE="Detail";
END
INSTRUCTIONS
SCREEN RECORD list1(FORMONLY.*);
END
The program code main.4gl:
MAIN
    DEFINE arr DYNAMIC ARRAY OF RECORD
               key INTEGER,
               name STRING,
               image STRING,
               detail STRING
           END RECORD,
           x INTEGER
    FOR x=1 TO 60
        LET arr[x].key = x
        LET arr[x].name = SFMT("Item %1", x)
        LET arr[x].image = IIF(x MOD 2, "file", "folder")
        LET arr[x].detail = SFMT("This is item %1", x)
    END FOR
    OPEN FORM f1 FROM "form"
    DISPLAY FORM f1
    DISPLAY ARRAY arr TO list1.* ATTRIBUTES(UNBUFFERED,DOUBLECLICK=myselect)
        ON ACTION myselect
           MESSAGE "myselect:", arr_curr()
    END DISPLAY
END MAIN