Example 1: Simple list view
The form file table.per (grid-based layout):
LAYOUT
TABLE
{
[c1 |c2 ]
}
END
END
ATTRIBUTES
PHANTOM FORMONLY.key;
c1 = FORMONLY.name, IMAGECOLUMN=image;
PHANTOM FORMONLY.image;
c2 = FORMONLY.detail;
END
INSTRUCTIONS
SCREEN RECORD list1(FORMONLY.*);
END
The form file table.per (stack-based layout):
LAYOUT
STACK
TABLE list1
PHANTOM FORMONLY.key;
EDIT FORMONLY.name,
IMAGECOLUMN=image, TITLE="Name";
PHANTOM FORMONLY.image;
EDIT FORMONLY.detail, TITLE="Detail";
END
END
END
The program main.4gl:
MAIN
DEFINE arr DYNAMIC ARRAY OF RECORD
key INTEGER,
name STRING,
image STRING,
detail STRING
END RECORD,
i INTEGER
FOR i=1 TO 60
LET arr[i].key = i
LET arr[i].name = SFMT("Item %1", i)
IF i MOD 2 THEN
LET arr[i].image = "file"
ELSE
LET arr[i].image = "smiley"
END IF
LET arr[i].detail = SFMT("This is item %1", i)
END FOR
OPEN FORM f1 FROM "table"
DISPLAY FORM f1
DISPLAY ARRAY arr TO list1.* ATTRIBUTES(UNBUFFERED,DOUBLECLICK=myselect)
ON ACTION myselect
MESSAGE "myselect:", arr_curr()
END DISPLAY
END MAIN