I have a problem with a DCbrowse of an array. When the array is empty, I'm getting an error. This is because the colorblock is using the array to define the color.
Code: Select all
#INCLUDE "dcdialog.CH"
FUNCTION Main()
LOCAL GetList[0], GetOptions, oBrowse
Local aDir := {}
@ 1,0 DCBROWSE oBrowse DATA aDir SIZE 40,10 FIT MAX 100 ;
USEVISUALSTYLE ;
CURSORMODE XBPBRW_CURSOR_ROW ;
FONT '10.Lucida Console' ;
SORTSCOLOR GRA_CLR_WHITE,GRA_CLR_RED SORTUCOLOR GRA_CLR_WHITE,GRA_CLR_RED ;
COLOR {|o,aSub|aSub := o:dataSource[o:arrayElement] , if(empty(aSub[1]),{ GRA_CLR_YELLOW , GRA_CLR_DARKGRAY},{ GRA_CLR_RED , GRA_CLR_DARKGRAY} )}
DCBROWSECOL ELEMENT 1 HEADER 'File Name' WIDTH 20 PARENT oBrowse
DCBROWSECOL ELEMENT 2 HEADER 'File Size' 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
I could make a change in the colorblock, but normally the dcbrowse methods should take care of this.