xBrowse header from an Array

xBrowse header from an Array

Postby Rick Lipkin » Wed Aug 05, 2015 4: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: Select all  Expand view


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

 


Image

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse header from an Array

Postby cnavarro » Wed Aug 05, 2015 5:07 pm

Try

Code: Select all  Expand view


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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: xBrowse header from an Array

Postby Rick Lipkin » Wed Aug 05, 2015 5:19 pm

Christabol

Unfortunately .. that did not work ..

Image

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse header from an Array

Postby alerchster » Wed Aug 05, 2015 7:17 pm

I think you have to build the Array in this way!

Code: Select all  Expand view


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
User avatar
alerchster
 
Posts: 92
Joined: Mon Oct 22, 2012 4:43 pm

Re: xBrowse header from an Array

Postby Rick Lipkin » Wed Aug 05, 2015 7:36 pm

Anton

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

Thanks
Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse header from an Array

Postby Rick Lipkin » Wed Aug 05, 2015 8:26 pm

To All

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

Code: Select all  Expand view

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

 

Image

Was hoping for a more elegant solution.

Rick LIpkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse header from an Array

Postby reinaldocrespo » Wed Aug 05, 2015 9: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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: xBrowse header from an Array

Postby James Bott » Sat Aug 08, 2015 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xBrowse header from an Array

Postby Francisco Horta » Sat Aug 08, 2015 5: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
Francisco Horta
 
Posts: 845
Joined: Sun Oct 09, 2005 5:36 pm
Location: la laguna, mexico.

Re: xBrowse header from an Array

Postby nageswaragunupudi » Sat Aug 22, 2015 7:39 pm

Method-1

Code: Select all  Expand view
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: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10622
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 59 guests