Problem with dcbrowse and empty array

This forum is for eXpress++ general support.
Message
Author
skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Problem with dcbrowse and empty array

#11 Post by skiman »

Hi Roger,

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
If it is not possible, i can live with it. However I have to check some code to see if there are situations where this can happen. In fact every array browsing where a user can delete rows, can have this problem if some DATA {|| ... } codeblock is used.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Problem with dcbrowse and empty array

#12 Post by rdonnay »

This would require modifying the Alaska source code for XbpBrowse() or overloading many of its methods.

I'm sure it could be done, but I don't really have sufficient time to put into this right now. I'm overloaded with work on a project that will last through April.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Problem with dcbrowse and empty array

#13 Post by skiman »

Hi Roger,

No problem. I learned from this topic, so that's already positive. I have to check some codeblocks now.

I have a customer who has an error on a regular base. Now I'm quite sure he is deleting all the elements in his browse.
Best regards,

Chris.
www.aboservice.be

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: Problem with dcbrowse and empty array

#14 Post by bwolfsohn »

I've always created an empty first row in an array if there is none to workaround these problems..

seemed like the easier solution at the time.. :)
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

Post Reply