I was thinking about a check when browsing an array. If the array is empty, no row have to be drawn. So no codeblok should be evaluated.
The following gives an error with an empty array. This doesn't seem logical to me. If there is data in the array, it is up to the programmer to be sure that the data in element 2 is numeric. If there is an empty array, in my opinion nothing should happen.
Code: Select all
#INCLUDE "dcdialog.CH"
FUNCTION Main()
LOCAL GetList[0], GetOptions, oBrowse, aDir
aDir := {} // Directory()
@ 1,0 DCBROWSE oBrowse DATA aDir SIZE 40,10 FIT MAX 100 ;
CURSORMODE XBPBRW_CURSOR_ROW
DCBROWSECOL ELEMENT 1 HEADER 'File Name' WIDTH 20 PARENT oBrowse
DCBROWSECOL ELEMENT 2 HEADER 'File Size' WIDTH 10 PARENT oBrowse
DCBROWSECOL DATA {|| if(DC_GetColArray(2,oBrowse)>1000, "YES","NO") } HEADER '> 1K' WIDTH 10 PARENT oBrowse
DCBROWSECOL ELEMENT 3 HEADER 'File Date' WIDTH 10 PARENT oBrowse
DCBROWSECOL ELEMENT 4 HEADER 'File Time' WIDTH 10 PARENT oBrowse
DCGETOPTIONS RESIZE
DCREAD GUI FIT TITLE 'Testing Owner Draw Browse' OPTIONS GetOptions
RETURN nil