User interface programming / Table views |
You can use PHANTOM fields and the IMAGECOLUMN attribute to display images in a column, to the left of the column value.
LAYOUT TABLE { [c1 |c2 ] [c1 |c2 ] [c1 |c2 ] } END END ATTRIBUTES PHANTOM FORMONLY.file_icon; EDIT c1 = FORMONLY.file_name, IMAGECOLUMN=file_icon; EDIT c2 = FORMONLY.file_size; ... END INSTRUCTIONS SCREEN RECORD sr(FORMONLY.*); END
DEFINE arr DYNAMIC ARRAY OF RECORD file_icon STRING, file_name STRING, file_size INTEGER END RECORD ... FOR x=1 TO max_files CASE file_type(arr[x].file_name) WHEN "file" LET arr[x].file_icon = "file" WHEN "dir" LET arr[x].file_icon = "folder" END CASE END FOR ... DISPLAY ARRAY arr TO sr.* ... END DISPLAY
DEFINE arr DYNAMIC ARRAY OF RECORD pic_num INTEGER, pic_data BYTE, pic_when DATETIME YEAR TO SECOND END RECORD ... DECLARE c1 CURSOR FOR SELECT * FROM mypics LET i=1 LOCATE arr[i].pic_data IN FILE FOREACH c1 INTO arr[i].* LOCATE arr[i:=i+1].pic_data IN FILE END FOREACH CALL arr.deleteElement(i) ...