Example 1: Simple scrollgrid view
The form file scrollgrid.per:
LAYOUT
SCROLLGRID (WANTFIXEDPAGESIZE=NO, INITIALPAGESIZE=4, STYLE="paged")
{
[f1 ] Id: [f2 ] Name:[f3 ]
[ ] Details:
[ ] [f4 ]
[ ] [ ]
[ ] [ ]
}
END
END
ATTRIBUTES
EDIT f2 = FORMONLY.key;
EDIT f3 = FORMONLY.name;
IMAGE f1 = FORMONLY.image, SIZEPOLICY=FIXED, AUTOSCALE;
EDIT f4 = FORMONLY.detail;
END
INSTRUCTIONS
SCREEN RECORD list1(FORMONLY.*);
END
The presentation style file contains:
<Style name="Scrollgrid.paged" >
<StyleAttribute name="customWidget" value="pagedScrollGrid" />
</Style>
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 "scrollgrid"
DISPLAY FORM f1
DISPLAY ARRAY arr TO list1.* ATTRIBUTES(UNBUFFERED,DOUBLECLICK=myselect)
ON ACTION myselect
MESSAGE "myselect:", arr_curr()
END DISPLAY
END MAIN