bb.donnay-software.com

Donnay Software Web Forums
It is currently Sat Feb 22, 2020 3:50 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: DCBROWSECOL .... FOOTER
PostPosted: Thu May 16, 2019 3:22 pm 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:39 pm
Posts: 482
Hi all

I discovered that DCBROWSECOL .... FOOTER cause IDC error.

Run the code below:
Code:
FUNCTION XSample_19                                                           
                                                                               
/*  ARRAY BROWSER WITH COLORS                                                                                                                                 
 This example demonstrates how to control the color of cells in               
 an array browser using DCBROWSE.  In this example, the color of               
 the SIZE cells is dependent on the size of the file.  The                     
 function DC_GETCOLARRAY() is used as a pointer into the array                 
 being browsed.                                                                                                                                             
*/                                                                             
                                                                               
LOCAL GetList := {}, cDir, oFileName, aDirectory, i, ;                   
      nPointer, oDirectory, aColors, bColor, GetOptions, cFooter := TRANSFORM(0,"###,###,###")                       
                                                                               
cDir := Space(30)                                                         
                                                                               
@ 2,2 DCGET cDir GETSIZE 43  POPUP {|c|DC_PopDir(c)}                           
                                                                               
aDirectory := Directory()                                                     
FOR i := 1 TO Len(aDirectory)                                                 
  ASize(aDirectory[i],5)                                                       
  aDirectory[i,5] := .f.                                                       
NEXT                                                                           
ASort(aDirectory,,,{|a,b|a[1]<b[1]})                                           
                                                                               
@ 3.5,2 DCBROWSE oDirectory DATA aDirectory ;                                 
      SIZE 60,12 ;                                                             
      FONT '10.Helv Bold' ;                                                   
      PRESENTATION DC_BrowPres() ;                                             
      POINTER nPointer ;                                                       
      OPTIMIZE ;                                                               
      FIT ;                                                                   
      NOHSCROLL ;                                                             
      MARK 5 ;                                                                 
      MKCOLOR 5, GRA_CLR_WHITE, GRA_CLR_BLUE                                   
                                                                               
aColors := { {GRA_CLR_WHITE,GRA_CLR_DARKRED}, ;                               
             {GRA_CLR_WHITE,GRA_CLR_DARKBLUE}, ;                               
             {GRA_CLR_BLACK,GRA_CLR_DARKGREEN}, ;                             
             {GRA_CLR_BLACK,GRA_CLR_YELLOW} }                                 
                                                                               
bColor := {| nSize, nCase | nSize := DC_GetColArray(2,oDirectory),;           
              nCase := DC_PickCase(nSize,'>=',;                               
                          {1000000,100000,10000,0}, ;                         
                          {      1,     2,    3,4} ), aColors[nCase] }         
                                                                               
DCBROWSECOL ELEMENT 1 WIDTH 10 HEADER "Name" PARENT oDirectory                 
                                                                               
DCBROWSECOL ELEMENT 2 WIDTH 7 HEADER "Size" PARENT oDirectory ;               
  EVAL { |o|o:colorBlock := bColor } // FOOTER {|| cFooter }                                         
                                                                               
DCBROWSECOL ELEMENT 3 WIDTH 8 HEADER "Date" PARENT oDirectory                 
                                                                               
DCBROWSECOL ELEMENT 4 WIDTH 6 HEADER "Time" PARENT oDirectory                 
                                                                               
DCBROWSECOL ELEMENT 5 WIDTH 4 HEADER "Marked" PARENT oDirectory   

@ 2,50  DCPUSHBUTTON CAPTION "Display" SIZE 7,0.8 ;
        ACTION {|| _UpdateDirFooter(aDirectory, cDir, @cFooter, GetList, oDirectory)}             
                                                                               
DCGETOPTIONS NOMINBUTTON NOMAXBUTTON NORESIZE TABSTOP                         
                                                                               
DCREAD GUI ;                                                                   
   OPTIONS GetOptions ;                                                       
   FIT ;                                                                       
   MODAL ;                                                                     
   BUTTONS DCGUI_BUTTON_OK + DCGUI_BUTTON_CANCEL ;                             
   TITLE 'Array Browse of Directory' 
                                                                               
RETURN nil
*
Static Function _UpdateDirFooter(aDir, cDir, cFooter, GetList, oDirectory)
Local nSize := 0, i
aDir := Directory(AllTrim(cDir)+"\*.*")
aEval(aDir, {|e| nSize += e[2]})
cFooter := TRANSFORM(nSize, "###,###,###")
FOR i := 1 TO Len(aDir)                                                 
  ASize(aDir[i],5)                                                       
  aDir[i,5] := .f.                                                       
NEXT
DC_GetBrowArray(oDirectory,aDir)                           
DC_GetRefresh(GetList)
Return nil                                                                   
                                                                               
* ------------   


Top
 Profile  
 
PostPosted: Fri May 17, 2019 12:39 am 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:39 pm
Posts: 482
Attachment:
DCBrowseColFooter.png
DCBrowseColFooter.png [ 172.52 KiB | Viewed 2175 times ]


Top
 Profile  
 
PostPosted: Fri May 17, 2019 1:06 am 
Offline
User avatar

Joined: Thu Jan 28, 2010 12:59 am
Posts: 750
Location: Berlin, Germany
You need a footer in every column. Create empty footers for the other columns (... FOOTER "-").

_________________
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."


Top
 Profile  
 
PostPosted: Fri May 17, 2019 1:32 am 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:39 pm
Posts: 482
Thanks Tom

Worked now. Roger should mention it in the doc.


Top
 Profile  
 
PostPosted: Fri May 17, 2019 3:16 am 
Offline
User avatar

Joined: Thu Jan 28, 2010 12:59 am
Posts: 750
Location: Berlin, Germany
This is not Roger's mistake.

Anyway, look at your screenshot. Besides it doesn't work - it doesn't look very good, having footers at a position where column values are expected. ;)

_________________
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."


Top
 Profile  
 
PostPosted: Fri May 17, 2019 5:58 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4076
Location: Boise, Idaho USA
Quote:
Worked now. Roger should mention it in the doc.


I suppose I should have mentioned that, but it never occurred to me that someone would want footers only on some columns, and not others. Tom is right. That's a strange way to design a browse.

It will require much more work for me to modify my code to fill in the empty footers than it will for you to do as Tom suggested.

Each column object knows nothing about other column objects, so the only way to handle this is to add another clause to the DCBROWSE object that would set some kind of default. That's more changes to DCDIALOG.CH, DC_XbpBrowse() class and the documentation. If this issue had been brought up 15-20 years ago, when I first wrote the browse system, I may have thought that this was a major design flaw. But after this long, with no other complaints from eXpress++ users, I will leave well enough alone. I have some bigger fish that I am frying right now which adds major new features to the browse system.

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Sat May 18, 2019 12:29 pm 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:39 pm
Posts: 482
Roger

I agree with you totally

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group