FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse header from an Array
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
xBrowse header from an Array
Posted: Wed Aug 05, 2015 04:11 PM
To All

I know I have done this before ... I am creating an empty array without any rows and assigning it to xBrowse. I remember I could define the Headers from an array ... I do not want any rows to show in xBrowse .. I just want to define my columns with headers .. this does not work.
Code (fw): Select all Collapse
aPlan    := {}
aColumns := {}


AAdd( aColumns, { "Budget Item",         ;
                  "Origional Budget",    ;
                  "Budget Revision",     ;
                  "Current Budget",      ;
                  "Origional Contract",  ;
                  "Contract Revisions",  ;
                  "Current Committed",   ;
                  "Pending Proposals",   ;
                  "Potential Exposures", ;
                  "Potential Costs",     ;
                  "Potential Proj Costs" } )

REDEFINE xBROWSE oLbx3  ;
              ARRAY aPlan             ;
              HEADERS aColumns        ;  // <----- here
              COLSIZES 65,43,43,43,43,43,43,43,43,43,43 ; // 11
              ID 174 of oCust     ;
              AUTOCOLS CELL LINES




Thanks
Rick Lipkin
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: xBrowse header from an Array
Posted: Wed Aug 05, 2015 05:07 PM
Try

Code (fw): Select all Collapse
HEADERS aColumns[ 1 ]        ;  // <----- here
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse header from an Array
Posted: Wed Aug 05, 2015 05:19 PM
Christabol

Unfortunately .. that did not work ..



Rick Lipkin
Posts: 137
Joined: Mon Oct 22, 2012 04:43 PM
Re: xBrowse header from an Array
Posted: Wed Aug 05, 2015 07:17 PM
I think you have to build the Array in this way!

Code (fw): Select all Collapse
aPlan    := {}
aColumns := {}

AAdd( aColumns, "Budget Item" )
AAdd( aColumns, "Origional Budget" )
AAdd( aColumns, "Budget Revision" )
AAdd( aColumns, "Current Budget" )
AAdd( aColumns, "Origional Contract" )
AAdd( aColumns, "Contract Revisions" )
AAdd( aColumns, "Current Committed" )
AAdd( aColumns, "Pending Proposals" )
AAdd( aColumns, "Potential Exposures" )
AAdd( aColumns, "Potential Costs" )
AAdd( aColumns, "Potential Proj Costs" )

REDEFINE xBROWSE oLbx3  ;
              ARRAY aPlan             ;
              HEADERS aColumns        ;  // <----- here
              COLSIZES 65,43,43,43,43,43,43,43,43,43,43 ; // 11
              ID 174 of oCust     ;
              AUTOCOLS CELL LINES
Regards



Ing. Anton Lerchster
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse header from an Array
Posted: Wed Aug 05, 2015 07:36 PM

Anton

Your solution works as long as aPlan has a single record .. I wanted to leave ( the data ) aPlan empty.

Thanks
Rick

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse header from an Array
Posted: Wed Aug 05, 2015 08:26 PM
To All

Kind of a sloppy work around was to resize the array to zero ON INIT

Code (fw): Select all Collapse
 ACTIVATE DIALOG oCust  NOWAIT ;
          ON INIT ( oCust:Move(0,0),Asize( aPlan,0 ),oLbx3:ReFresh() ) ; //<----- 
          VALID(!GETKEYSTATE( 27 ))



Was hoping for a more elegant solution.

Rick LIpkin
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: xBrowse header from an Array
Posted: Wed Aug 05, 2015 09:29 PM

Hey Rick;

I'm a friend of anything that works. Even better If it can be done elegantly but at the end of the day all that matters is if it works and how much time/effort it took. Admittedly I like it simple, stupid and quick. So far I happen to be doing the same thing as you to solve this very same problem. Thank you for posting this question. I was hoping you got a better answer to this thread. I'm sure there is. Please keep me posted if you do find it.

Best regards,

Reinaldo.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: xBrowse header from an Array
Posted: Sat Aug 08, 2015 03:51 PM

Rick,

I don't know if this would help, but did you know you can create temp data files in memory? They are like arrays but work just like DBFs. There was a recent thread on this. Perhaps this would solve your header problem.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 845
Joined: Sun Oct 09, 2005 05:36 PM
Re: xBrowse header from an Array
Posted: Sat Aug 08, 2015 05:35 PM
Rick

Try,

REDEFINE xBROWSE oLbx3 ;
ARRAY aPlan ;
HEADERS aColumns ; // <----- here
COLUMNS 1,2,3,4,5,6,7,8,9,10,11 ; <------ Add
COLSIZES 65,43,43,43,43,43,43,43,43,43,43 ; // 11
ID 174 of oCust ;
AUTOCOLS CELL LINES

Regards
Paco
____________________

Paco
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse header from an Array
Posted: Sat Aug 22, 2015 07:39 PM
Method-1

Code (fw): Select all Collapse
aPlan    := {}
aColumns := {}

aHeaders  := { "Budget Item",         ;
                  "Origional Budget",    ;
                  "Budget Revision",     ;
                  "Current Budget",      ;
                  "Origional Contract",  ;
                  "Contract Revisions",  ;
                  "Current Committed",   ;
                  "Pending Proposals",   ;
                  "Potential Exposures", ;
                  "Potential Costs",     ;
                  "Potential Proj Costs" } 

AEval( aHeaders, { |u,i| AAdd( aColumns, i ) } )

REDEFINE xBROWSE oLbx3  ;
              ARRAY aPlan             ;
              COLUMNS aColumns        ;
              HEADERS aHeaders        ;  // <----- here
              COLSIZES 65,43,43,43,43,43,43,43,43,43,43 ; // 11
              ID 174 of oCust     ;
              CELL LINES


METHOD-2
Code (fw): Select all Collapse
aPlan    := {}

aSpec :=  { ;
   {  1, "Budget Item",         nil, 65 }, ;
   {  2, "Origional Budget",    nil, 43 }, ;
   {  3, "Budget Revision",     nil, 43 }, ;
   {  4, "Current Budget",      nil, 43 }, ;
   {  5, "Origional Contract",  nil, 43 }, ;
   {  6, "Contract Revisions",  nil, 43 }, ;
   {  7, "Current Committed",   nil, 43 }, ;
   {  8, "Pending Proposals",   nil, 43 }, ;
   {  9, "Potential Exposures", nil, 43 }, ;
   { 10, "Potential Costs",     nil, 43 }, ;
   { 11, "Potential Proj Costs",nil, 43 }  }

// { Exprn/ArrayColNo, cHeader, cPicture, nWidth, lnAlign, cSortOrder } 

REDEFINE xBROWSE oLbx3  ;
              ARRAY aPlan             ;
              COLUMNS aSpec        ;
              ID 174 of oCust     ;
              CELL LINES

Personally I prefer to write my programs using the Method-2.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion