Coloring a line Solved. Now coloring an individual cell

Coloring a line Solved. Now coloring an individual cell

Postby hag » Wed Jan 12, 2011 5:08 pm

Can't get the line to color. What am I doing wrong. Here is the code

Code: Select all  Expand view


// COLOR SET UP
oBrw:bClrStd := {||{CLR_BLACK,CLR_WHITE},{ If(gl->ty13 < 0, CLR_YELLOW, CLR_WHITE)  } }

 oBrw:bClrGrad := { | lInvert | If( ! lInvert, ;
   { { 0.710,8388608,16777215 }, ;
   {   0.710,16777215,8388608 } }, ;
   { { 0.710,8388608,16777215 }, ;
   {   0.710,16777215,8388608 } } ) }

// TYPICAL COLUMN IN THE BROWSE
 ADD TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485', ;
      repli(" ",30), trans(Eval(bty1),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m1+cActl1;  
      footer " "

// Nothing works.

 
Last edited by hag on Thu Jan 13, 2011 8:38 pm, edited 1 time in total.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Haveing trouble coloring a line in an xbrowse.

Postby nageswaragunupudi » Wed Jan 12, 2011 11:38 pm

Instead of
Code: Select all  Expand view
oBrw:bClrStd := {||{CLR_BLACK,CLR_WHITE},{ If(gl->ty13 < 0, CLR_YELLOW, CLR_WHITE)  } }
 

please try:
Code: Select all  Expand view
oBrw:bClrStd := {||If( gl->ty13 < 0, {CLR_BLACK,CLR_YELLOW},{CLR_BLACK,CLR_WHITE} ) }
 

Result is the row is colored Black on Yellow for negative values of ty13 and Black on White for positive values of ty13.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Haveing trouble coloring a line in an xbrowse.

Postby hag » Thu Jan 13, 2011 1:51 am

Rao:

As always perfect.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Haveing trouble coloring a line in an xbrowse.

Postby hag » Thu Jan 13, 2011 6:48 am

Roa maybe you can help me color a cell.
This is the code using xbrowse.

I get a bound array acess error.


Code: Select all  Expand view


//No array is declared

// color cell...I want to color third column on a recored. FixFlag1() finds the record.

oBrw:aCols[3]:bClrstd    := {||If(fixFlag1(),CLR_BLACK,CLR_YELLOW),CLR_WHITE }

// TYPICAL column 17 of them.

 ADD TO oBrw DATA ;
   If( gl->title = '-' .or. gl->title = '=' .or. ;
   gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
   repli("  ",30), trans(Eval(bty14), ;
   '999,999,999'));
   SIZE 71 ;
   RIGHT
   HEADER "Start Up";  
   footer " "



I just can't get it to work.

Thanks again
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Haveing trouble coloring a line in an xbrowse.

Postby nageswaragunupudi » Thu Jan 13, 2011 7:41 am

Code: Select all  Expand view
oBrw:aCols[3]:bClrstd    := {||If(fixFlag1(), { CLR_BLACK, CLR_YELLOW },{ CLR_BLACK, CLR_WHITE } ) }
 

or
Code: Select all  Expand view
oBrw:aCols[3]:bClrstd    := {|| { CLR_BLACK,  If( fixFlag1(), CLR_YELLOW, CLR_WHITE ) } }
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Haveing trouble coloring a line in an xbrowse.

Postby hag » Thu Jan 13, 2011 4:49 pm

Roa tried both of your recommendations ...always a bound array acess error on that line of code.
Here is the error. Maybe it will help.

Code: Select all  Expand view
Error occurred at: 01/13/11, 08:43:25
   Error description: Error BASE/1132  Bound error: array access
   Args:
     [   1] = A   { ... }
     [   2] = N   3
 


I even tried use oCol[3] instead of aCols[3] and got an argument error.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Coloring a line Solved. Now coloring an individual cell

Postby nageswaragunupudi » Fri Jan 14, 2011 1:39 am

Can you please post your full code for the browse and explain what is it want to show?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Coloring a line Solved. Now coloring an individual cell

Postby hag » Fri Jan 14, 2011 3:32 am

Messy code:
IF YOU NEED ANYTHING ELSE LET ME KNOW.

DEFINE FONT oFont3 NAME "Ms Sans Serif" SIZE 2,1
 DEFINE WINDOW oWnd TITLE "View Print Edit Reports" ;
 COLOR CLR_WHITE, CLR_WHITE

 if viewingMulti == 0

    define dialog oDlg resource "hagbrow" of oWnd1 TRANSPARENT TITLE cItem Font oFont3

      REDEFINE TABS oTabs PROMPTS "Profit And Loss", "Cash Flow", "Balance Sheet", "Product Analysis", "Credit Line Usage","Information",cCalc ID 4001 OF oDlg;
      action(nnOPtion := oTabs:nOption,xpicard(oDlg,oBrw,nnOption,xCol,oSay35,oSay36,oSay37))   update
   else
      define dialog oDlg resource "hagbrow" of oWnd1 TRANSPARENT TITLE cItem Font oFont3

      REDEFINE TABS oTabs PROMPTS "Profit And Loss", "Cash Flow", "Balance Sheet", "Product Analysis", "Credit Line Usage","Information",cCalc ID 4001 OF oDlg;
      action(nnOPtion := oTabs:nOption,xpicard(oDlg,oBrw,nnOption,xCol,oSay35,oSay36,oSay37))   update

   endif   
   oDlg:oTop := oTabs

   getcoors(ownd1:nTop,ownd1:nLeft,ownd1:nBottom,ownd1:nRight)

   if ownd1:nright >= 1020 //.and. ownd1:nright < 1028 

      if bFont[1]   <= 16

         oDlg:bResized  :=                           ;
         {|| aRect  := GetWndRect(oDlg:hWnd),    ;
         oBrw:Move( 24,4,arect[ 4 ]-arect[ 2 ] -16, ; //16
         aRect[3]-aRect[1]-175,.t.);       //150                                    // 130
         ,oBtn1:move(arect[3] -aRect[1]- 89,11  ,,,.t.);   //14  *
         ,oBtn5:move(arect[3] -aRect[1]- 89,197 ,,,.t.);   //106
         ,oBtn7:move(arect[3] -aRect[1]- 89,380 ,,,.t.);   //16
         ,oBtn2:move(arect[3] -aRect[1]- 119,481 ,,,.t.);  //4002
         ,oBtn13:move(arect[3] -aRect[1]-145,422 ,,,.t.);  //20
         ,oCbx:move(arect[3]  -aRect[1]- 89,575 ,,,.t.);   //18 Transfer data
         ,oCbx1:move(arect[3] -aRect[1]- 119,575 ,,,.t.);  //
         ,oCbx2:move(arect[3] -aRect[1]- 119,11  ,,,.t.);  //15 *
         ,oCbx3:move(arect[3] -aRect[1]- 119,197 ,,,.t.);  //14
         ,oCbx5:move(arect[3] -aRect[1]-  89,875 ,,,.t.);  //24
         ,oSay11:move(arect[3]-aRect[1]- 119,806 ,,,.t.);  //
         ,oSay12:move(arect[3]-aRect[1]- 111,806 ,,,.t.);  //
         ,oCbx4:move(                    "",728 ,,,.t.);   //reports
         ,oSay20:move(arect[3] -aRect[1]-145,11  ,,,.t.);  //75 *   //120
         ,oSay21:move(arect[3] -aRect[1]-145,197 ,,,.t.);  //23 *
         ,oBtn3:move(arect[3]  -aRect[1]-119,380 ,,,.t.)}  //103

         //,oBtn4:move(                    "",620 ,,,.t.); //calculate
         //,oBmp1:move(                    "",11 ,,,.t.);  //calculate
         //,oBmp5:move(arect[3] -aRect[1]- 149,380 ,,,.t.);// Info
         //,oSay13:move(                   "",855 ,,,.t.); //


      else
         //? "2"   


         oDlg:bResized  :=                           ;
         {|| aRect  := GetWndRect(oDlg:hWnd),    ;
         oBrw:Move( 24,4,arect[ 4 ]-arect[ 2 ] -16, ; //16
         aRect[3]-aRect[1]-207,.t.);    //150 //175                                 // 130
         ,oBtn1:move(arect[3] -aRect[1]- 102,5  ,,,.t.);   //14  *
         ,oBtn5:move(arect[3] -aRect[1]- 102,197 ,,,.t.);  //106
         ,oBtn7:move(arect[3] -aRect[1]- 102,380 ,,,.t.);  //16
         ,oBtn2:move(arect[3] -aRect[1]- 132,520 ,,,.t.);  //4002
         ,oBtn13:move(arect[3] -aRect[1]- 145,520 ,,,.t.); //20
         ,oCbx:move(arect[3]  -aRect[1]- 102,605 ,,,.t.);  //18 Transfer data
         ,oCbx5:move(arect[3] -aRect[1]-  89,875 ,,,.t.);  //24
         ,oCbx1:move(arect[3] -aRect[1]- 132,605 ,,,.t.);  //
         ,oCbx2:move(arect[3] -aRect[1]- 132,5  ,,,.t.);   //15 *
         ,oCbx3:move(arect[3] -aRect[1]- 132,197 ,,,.t.);  //14
         ,oSay11:move(arect[3]-aRect[1]- 132,806 ,,,.t.);  //
         ,oSay12:move(arect[3]-aRect[1]- 111,806 ,,,.t.);  //
         ,oCbx4:move(                    "",675 ,,,.t.);   //reports
         ,oSay20:move(arect[3] -aRect[1]-168,5  ,,,.t.);   // 75    *   //120
         ,oSay21:move(arect[3] -aRect[1]-168,197 ,,,.t.);  // 75    *
         ,oBtn3:move(arect[3]  -aRect[1]-132,380 ,,,.t.)}  //103

         //,oBtn4:move(                    "",575 ,,,.t.);  //calculate

         //,oBmp5:move(                    "",51 ,,,.t.);  //calculate
         //,oBmp1:move(                    "",11 ,,,.t.);  //calculate
         //,oBmp5:move(arect[3] -aRect[1]- 168,380 ,,,.t.); // Info
         //,oSay13:move(                   "",845 ,,,.t.);  //

      endif             
   endif


   if (oWnd1:nRight > 600 .AND. oWnd1:nRight    < 1020) 

      bFont := getFontInfo(hFont)   

      if bFont[1]   <= 16
         ///? "3"   

         ODLG:BRESIZED  :=                           ;
         {|| aRect  := GetWndRect(oDlg:hWnd),    ;
         oBrw:Move( 24,1,arect[ 4 ]-arect[ 2 ] - 27, ;
         aRect[3]-aRect[1]-150,.t.);
         ,oBtn1:move(arect[3] -aRect[1]- 55,5,   , ,.t.);  //14
         ,oBtn5:move(arect[3] -aRect[1]- 55,177  ,,,.t.);  //106
         ,oBtn7:move(arect[3] -aRect[1]- 55,333  ,,,.t.);  //16
         ,oBtn2:move(arect[3] -aRect[1]- 85,433  ,,,.t.);  //4002
         ,oBtn13:move(arect[3] -aRect[1]- 115,400 ,,,.t.); //20
         ,oCbx:move(arect[3]  -aRect[1]- 55,519  ,,,.t.);  //18 Transfer data
         ,oCbx1:move(arect[3] -aRect[1]- 85,519  ,,,.t.);  //
         ,oCbx2:move(arect[3] -aRect[1]- 85,5    ,,,.t.);  //15 
         ,oCbx3:move(arect[3] -aRect[1]- 85,177  ,,,.t.);  //14
         ,oCbx5:move(arect[3] -aRect[1]- 89,875  ,,,.t.);  //24
         ,oSay11:move(arect[3]-aRect[1]- 85,805  ,,,.t.);  //
         ,oSay12:move(arect[3]-aRect[1]- 52,805  ,,,.t.);  //
         ,oSay20:move(arect[3]-aRect[1]- 115,5   ,,,.t.);  // 75    *
         ,oSay21:move(arect[3]-aRect[1]- 115,177 ,,,.t.);  // 75    *
         ,oBtn3:move(arect[3] -aRect[1]- 85,349  ,,,.t.),oBrw:refresh()} //103

         //,oCbx4:move(                    "",680  ,,,.t.); //reports

         //,oBtn4:move(                    "",600  ,,,.t.); //calculate
         //,oBmp1:move(                    "",11   ,,,.t.);  //calculate
         //,oBmp5:move(arect[3] -aRect[1]- 119,352 ,,,.t.); // Info
         //,oSay13:move(                   "",804  ,,,.t.); //

         // win32      

      else
         //? "4"
         oDlg:bResized  :=                           ;
         {|| aRect  := GetWndRect(oDlg:hWnd),    ;
         oBrw:Move( 24,4,arect[ 4 ]-arect[ 2 ] -16, ;      //16
         aRect[3]-aRect[1]-175,.t.);    //150                                // 130
         ,oBtn1:move(arect[3] -aRect[1]- 89,5  ,,,.t.);    //14  *
         ,oBtn5:move(arect[3] -aRect[1]- 89,197 ,,,.t.);   //106
         ,oBtn7:move(arect[3] -aRect[1]- 89,380 ,,,.t.);   //16
         ,oBtn2:move(arect[3] -aRect[1]- 119,400 ,,,.t.);  //4002
         ,oBtn13:move(arect[3] -aRect[1]- 115,400 ,,,.t.); //20
         ,oCbx:move(arect[3]  -aRect[1]-  89,605 ,,,.t.);  //18 Transfer data
         ,oCbx5:move(arect[3] -aRect[1]- 89,875  ,,,.t.);  //24
         ,oCbx1:move(arect[3] -aRect[1]- 119,605 ,,,.t.);  //
         ,oCbx2:move(arect[3] -aRect[1]- 119,5  ,,,.t.);   //15 *
         ,oCbx3:move(arect[3] -aRect[1]- 119,197 ,,,.t.);  //14
         ,oSay11:move(arect[3]-aRect[1]- 119,806 ,,,.t.);  //
         ,oSay12:move(arect[3]-aRect[1]- 111,806 ,,,.t.);  //
         ,oCbx4:move(                    "",675 ,,,.t.);   //reports
         ,oSay20:move(arect[3] -aRect[1]-145,5  ,,,.t.);   // 75    *   //120
         ,oSay21:move(arect[3] -aRect[1]-145,197 ,,,.t.);  // 75    *
         ,oBtn3:move(arect[3]  -aRect[1]-119,380 ,,,.t.)}  //103

         //,oBtn4:move(                    "",575 ,,,.t.);  //calculate
         //,oBmp1:move(                    "",11 ,,,.t.);  //calculate
         //,oBmp5:move(                    "",51 ,,,.t.);  //calculate
         //,oSay13:move(                   "",845 ,,,.t.);  //

    endif               
   endif

   redefine column xbrowse oBrw ID 101 of oDlg cell lines //autocols //fastedit 
     oBrw:nMARQueesTYLE := MARQSTYLE_HIGHLROW    
       
     oBrw:bClrStd  := {||If(FixFlag(),{CLR_BLACK,CLR_YELLOW},{CLR_BLACK ,CLR_WHITE}) }
       
   //oBrw:aCols[3]:bClrstd := {||If(fixFlag1(), { CLR_BLACK, CLR_YELLOW },{ CLR_BLACK, CLR_WHITE } ) }
   //oBrw:aCols[3]:bClrstd := {|| { CLR_BLACK,If( fixFlag1(), CLR_YELLOW, CLR_WHITE ) } }
           
   if cFixoDbf  == .f.
      select bal       
      database oDbf     
      oDbf:GoTop() 
#translate oDbf:bal: => oDbf:
      oBrw:SetoDbf(oDbf)       
   else

      select gl
      database oDbf     
      oDbf:GoTop() 
      oBrw:SetoDbf(oDbf)       
      oBrw:cAlias   := oDbf:cAlias

#translate oDbf:gl: => oDbf:
      oBrw:nFreeze := 4       // freeze
   endif


   oBrw:bClrGrad := { | lInvert | If( ! lInvert, ;
   { { 0.710,8388608,16777215 }, ;
   {   0.710,16777215,8388608 } }, ;
   { { 0.710,8388608,16777215 }, ;
   {   0.710,16777215,8388608 } } ) }

   msize := 68 // 78

   if mWhichCountry == .t. // CANADA   

      if !EMPTY(cFrecast)
         ADD COLUMN TO xbrowse oBrw data {|| trans(oBrw:oDbf:gl:trend, '@Z 999.9') };
         SIZE 40 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER "TrendIt"

         ADD COLUMN TO xbrowse oBrw DATA {|| if(gl->gst == 1, "Yes", if(gl->gst == 0, " ",)) };
         SIZE 25 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER "GST" // blank cursor colm
      else
         ADD COLUMN TO xbrowse oBrw DATA {|| if(gl->gst == 1, "Yes", if(gl->gst == 0, " ",)) };
         SIZE 25 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER "GST" // blank cursor colm
      endif
   else 
      if !EMPTY(cFrecast)
         ADD COLUMN TO xbrowse oBrw data {|| trans(oBrw:oDbf:gl:trend, '@Z 999.9') };
         SIZE 40 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER "TrendIt"
      else
         //oBrw:hBmpCursor := LoadBitmap( GetResources(), "Z_Finger" )
         ADD TO xbrowse oBrw DATA {|| if(gl->gst == 1, "   ", if(gl->gst == 0, " ",)) };
         SIZE 20 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER " " // blank cursor colm
      endif
   endif       

   gl->(dbGoTop())

   oBrw:bLDblClick := { | nRow,nCol |if (nNewVar == 1,msginfo("Editing is not available while vewing this report."),(odlg:hide(),apicard( oBrw, nRow, nCol, odlg))),oBrw:refresh();
   ,oBrw:setfocus(),odlg:show(),needCalc(oDlg),oBrw:refresh(),oBrw:setfocus(),mPassMess := .t.}

   oBrw:bKeyChar  := { | nKey,nRow,nCol | if(nKey=VK_RETURN,;
   (IF(nNewVar == 1,msginfo("Editing is not available while in this report.");
   ,(odlg:hide(),apicard( oBrw, nRow, nCol, odlg))),whatUsing(oDlg),oDlg:update(),oBrw:refresh(),oBrw:setfocus(),odlg:show(),needCalc(oDlg)),),.t.}

   // 2007
   oBrw:bRClicked  := {| nRow,nCol | build(oBrw, nRow, nCol, odlg),oBrw:refresh(),oBrw:setfocus(),odlg:setfocus(),mPassMess := .t.}

   setkey (VK_F6,{|| newInfo(),oBrw:refresh(),oBrw:setfocus()})

   msgWait("Color coding departments. To see coding use the F12 key.","Attention",3)


   ADD TO xBROWSE oBrw ;
   data {|| if(gl->title == repli('-', 30), repli(' ' , 30), ;
   if(gl->title == repli('=', 30), repli(' ', 30), ;
   trans(gl->account,"9999"))) }    ;
   SIZE 36 LEFT HEADER "Account (dblclick to edit)"  COLOR CLR_BLACK,CLR_HGRAY 

   ADD  TO xBROWSE oBrw ;
   SIZE 6  LEFT COLOR {||IF((gl->account >= "1500" .AND. gl->account <= "2040"),{RGB(0,0,0),RGB(128,0,0)},;
   IF((gl->account >= "2055" .AND. gl->account <= "2500"),{RGB(0,0,0),RGB(0,0,128)},;
   IF((gl->account >= "2520" .AND. gl->account <= "2625"),{RGB(0,0,0),RGB(0,128,0)},;
   IF((gl->account >= "2635" .AND. gl->account <= "2720"),{RGB(0,0,0),RGB(0,128,128)},;
   IF((gl->account >= "2735" .AND. gl->account <= "2820"),{RGB(0,0,0),RGB(128,0,128)},;
   IF((gl->account >= "2835" .AND. gl->account <= "2920"),{RGB(0,0,0),RGB(128,128,0)},;
   IF((gl->account >= "3000" .AND. gl->account <= "3353"),{RGB(0,0,0),RGB(0,0,255)},;
   IF((gl->account >= "3360" .AND. gl->account <= "3480"),{RGB(0,0,0),RGB(255,0,255)},;
   IF((gl->account >= "3491" .AND. gl->account <= "3544"),{RGB(0,0,0),RGB(255,128,0)},;
   IF((gl->account >= "2935" .AND. gl->account <= "2996"),{RGB(0,0,0),RGB(0,255,0)},;
   {RGB(0,0,0),RGB(255,255,255)}))))))))))}


   ADD TO xBROWSE oBrw ;
   data {|| if(gl->title == repli('-', 30), repli(' ' , 30), ;
   if(gl->title == repli('=', 30), repli(' ', 30), ;
   eval(cBal))) }   ;
   SIZE 140  LEFT HEADER "Account (dblclick to edit)"  //COLOR CLR_BLACK,CLR_HGRAY 



   * ADD TO oBrw DATA ;
   * If( gl->title = '-' .or. gl->title = '='  .or. ;
   * gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485', ;
   * repli("  ",30), trans(Eval(bty13),  ;
   * '999,999,999'),;
   * SIZE 71 ;
   * RIGHT ;   
   * HEADER cone  


   * ADD TO oBrw DATA ;
   * If( gl->title = '-' .or. gl->title = '=' .or. ;
   * gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485', ;
   * repli("  ",30), trans(Eval(bty14), ;
   * '999,999,999'));  
   * SIZE 71 ;
   * RIGHT ;   
   * HEADER "Start Up";  
   * footer " "

   //(gl->account $ '4601,4602,4603,4604,4605,4607,4608,4609,4610',trans(Eval(bty13),'@Z 999,999,999'))) ;

   // msetmths := 13

   /////NEW

   * ADD TO oBrw DATA ;
   * If( gl->title = '-' .or. gl->title = '='  .or. ;
   * gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485', ;
   * repli("  ",30), trans(Eval(bty15),  ;
   * '999,999,999')) ;
   * SIZE 71 ;
   * RIGHT ;   
   * HEADER cone  

   // here     

   ADD TO oBrw DATA ;
   If( gl->title = '-' .or. gl->title = '=' .or. ;
   gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
   repli("  ",30), trans(Eval(bty14), ;
   '999,999,999'));
   SIZE 71 ;
   RIGHT ; 
   HEADER "Start Up";  
   footer " "

   //.or. if(gl->account $ '4601,4602,4603,4604,4605,4607,4608,4609,4610',trans(Eval(bty13),'@Z 999,999,999')) ;


   //If( gl->account $ '3000',CLR_BLACK,CLR_BLUE));
   //If( gl->account $ '3000',CLR_BLACK,CLR_BLUE," " )

   if msetmths >=1

      if lUseThis   == .F.  .AND. gl->act1 > 1
         cActl1 := "-Actual"
      else
         cActl1 := ""
      endif

      ADD TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty1),  ;
      '999,999,999'))  ;
      SIZE msize       ;
      RIGHT            ;   
      HEADER m1+cActl1 ;  
      footer " "

   endif
   if msetmths >=2

      if lUseThis   == .F.  .AND. gl->act2 > 1
         cActl2 := "-Actual"
      else
         cActl2 := ""
      endif

      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty2),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m2+cActl2;  
      footer " "

      if msetmths = 2

         ADD  TO oBrw DATA ;
         If( gl->title = '-' .or. gl->title = '=' .or. ;
         gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
         repli(" ",30),trans(Eval(bPercent),;
         '999.9'))  ;
         SIZE msize ;
         RIGHT ;   
         HEADER "%";  
         footer " "

      endif

   endif
   if msetmths >=3

      if lUseThis   == .F.  .AND. gl->act3 > 1
         cActl3 := "-Actual"
      else
         cActl3 := ""
      endif

      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty3),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m3+cActl3;  
      footer " "

      if msetmths == 3

         ADD  TO oBrw DATA ;
         If( gl->title = '-' .or. gl->title = '=' .or. ;
         gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
         repli(" ",30), trans(Eval(bPercent),  ;
         '999.9' )) ;
         SIZE msize ;
         RIGHT ;   
         HEADER "%" ;
         footer " "

      endif

   endif
   if msetmths >=4

      if lUseThis   == .F.  .AND. gl->act4 > 1
         cActl4 := "-Actual"
      else
         cActl4 := ""
      endif


      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty4),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m4+cActl4;  
      footer " "



   endif
   if msetmths >=5

      if lUseThis   == .F.  .AND. gl->act5 > 1
         cActl5 := "-Actual"
      else
         cActl5 := ""
      endif

      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty5),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m5+cActl5;  
      footer " "

   endif
   if msetmths >=6

      if lUseThis   == .F.  .AND. gl->act6 > 1
         cActl6 := "-Actual"
      else
         cActl6 := ""
      endif

      ADD  TO oBrw DATA ;
      If(  gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty6),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m6+cActl6;  
      footer " "


   endif
   if msetmths >=7

      if lUseThis   == .F.  .AND. gl->act7 > 1
         cActl7 := "-Actual"
      else
         cActl7 := ""
      endif

      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty7),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m7+cActl7;
      footer " "


   endif
   if msetmths >=8
      if lUseThis   == .F.  .AND. gl->act8 > 1
         cActl8 := "-Actual"
      else
         cActl8 := ""
      endif


      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty8),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m8+cActl8;  
      footer " "

   endif
   if msetmths >=9

      if lUseThis   == .F.  .AND. gl->act9 > 1
         cActl9 := "-Actual"
      else
         cActl9 := ""
      endif

      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty9),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m9+cActl9;  
      footer " "

   endif
   if msetmths >=10

      if lUseThis   == .F.  .AND. gl->act10 > 1
         cActl10 := "-Actual"
      else
         cActl10 := ""
      endif

      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty10), ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m10+cActl10;  
      footer " "


   endif
   if msetmths >=11

      if lUseThis   == .F.  .AND. gl->act11 > 1
         cActl11 := "-Actual"
      else
         cActl11 := ""
      endif


      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty11), ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m11+cActl11 ;  
      footer " "


   endif
   if msetmths >=12

      if lUseThis   == .F.  .AND. gl->act12 > 1
         cActl12 := "-Actual"
      else
         cActl12 := ""
      endif

      ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty12), ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;   
      HEADER m12+cActl12;
      footer " "

   endif

   /////NEW

   if cFixOdbf  == .t.

      if msetmths > 3   

         ADD  TO oBrw DATA ;
         If( gl->title = '-' .or. gl->title = '=' .or. ;
         gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485', ;
         repli(" ",30), trans(Eval(bPercent), ;
         '999.9'))  ;
         SIZE msize ;
         RIGHT ;   
         HEADER "%";  
         footer " "

      endif
   endif

   REDEFINE SAY ID 12 OF ODLG  COLOR CLR_WHITE, CLR_RED

   // DISPALAY SENSITIVITY         

   redefine button obtn1 id 14 of oDlg ;
   ACTION(oDlg:hide(),setcalc(),lsetmess := .t.,whatifi(),oDlg:show(),openfilter := .f., asetfilter(.f.,obrw),setcalc2(obrw,odlg,2),oBrw:setfocus())    

   if !EMPTY(cFrecast)
      REDEFINE SAY oSay10 prompt alltrim(cFrecast) ID 51 OF ODLG  COLOR CLR_WHITE, CLR_RED //COLOR CLR_RED, CLR_WHITE
   else
      REDEFINE SAY oSay10 ID 51 OF ODLG  
   endif       

   * if viewingMulti == 0

   REDEFINE SAY oSay35  ID 412  OF ODLG COLOR CLR_WHITE,CLR_BLUE
   REDEFINE SAY oSay36  ID 413  OF ODLG COLOR CLR_WHITE,CLR_BLUE
   REDEFINE SAY oSay37  ID 414  OF ODLG COLOR CLR_WHITE,CLR_BLUE
   REDEFINE SAY oSay11  ID 200  OF ODLG COLOR CLR_WHITE,CLR_BLUE
   REDEFINE SAY oSay12  ID 201  OF ODLG COLOR CLR_WHITE,CLR_BLUE

   * endif

   //REDEFINE SAY oSay13 prompt cWhatView ID 400 OF ODLG  update COLOR CLR_WHITE,CLR_RED

   * if viewingMulti == 0   

   REDEFINE SAY oSay20 prompt cWhichSales ID 75 OF ODLG update COLOR CLR_WHITE,CLR_BLUE  
   REDEFINE SAY oSay21 prompt cWhichCost  ID 23 OF ODLG update COLOR CLR_WHITE,CLR_BLUE  

   * endif

   // RUN MULTI YEAR
   redefine button obtn9 id 17 of oDlg  ;          
   action(toCalcOrNot(obrw,oDlg),isMultiYear(),msgwait("Multi year forecast updated.","Please Wait",1))

   redefine button obtn2 id 4002 of odlg  ;
   action(toCalcOrNot(obrw,oDlg),toExitPrint(oDlg,oBrw,nNewVar,nIndex,msize))

   redefine button obtn13 id 20 of odlg  ;
   action(find2(2,oBrw," ",.f.,oDlg,oDbf,2))

   redefine button obtn3 id 103 of oDlg ;
   action(nRecNo := gl->(recno()),oDlg:hide(),openfilter := .t.,addnewaccounts(obrw,odlg,msendtitle,nNewVar),asetfilter(.t.,obrw),gl->(dbgoto(nRecno)),oDlg:show(),oBrw:refresh(),oBrw:setfocus())

   * redefine button obtn4 id 105 of oDlg ;
   * action(asetcalc(obrw,ODLG),setTheOrder(),gl->(dbgoto(1)),obrw:refresh(),obrw:setfocus())

   redefine button obtn5 prompt cCaption id 106 of oDlg ;
   action(oDlg:hide(),addexp(obrw,odlg,.f.,.f.,nNewVar),goforward := .t.,odlg:show(),gl->(dbgotop()),oBrw:refresh(),oBrw:setfocus(),mPassMess := .t.,setMess(oDlg,oBrw),cPrompt := "Select accounts to display", oDlg:update(),.t.)

   // new 1/25/2009

   redefine button obtn7 prompt cPrompt id 16 of oDlg ;
   action(if(nWhichDisp == 1,(openfilter := .f., asetfilter(.f.,obrw),gl->(dbgoto(1)),oBtn7:setText("Select accounts to display"), nWhichDisp := 0),;
   (nRecNo := gl->(recno()),oDlg:hide(),openfilter := .t.,addnewaccounts(obrw,odlg,msendtitle,nNewVar),asetfilter(.t.,obrw),gl->(dbgoto(nRecno),oDlg:show(),oBtn7:setText("Display only accounts being used"),nWhichDisp := 1)) ),oBrw:setFocus())

   * redefine button obtn7 id 16 of oDlg ;
   * action(openfilter := .f., asetfilter(.f.,obrw),gl->(dbgoto(1)),oBrw:setfocus(),oBrw:refresh(),oBrw:setfocus())

   if lusingOnehr == .f.

      if nfp == .T.
         cPandl1 := "         < Other Activity Items >"     

         REDEFINE COMBOBOX OCBX1 VAR cPandl1 ITEMS { "         < Other Activity Items >",;
         "Credit line financing and Interest expense"                 ,;
         "Amortization of prepaid expenses"                           ,;
         "Due to from owners/affiliate and Interest owners"           ,;
         "Expense as a percent of change in net assets"               ,;
         "Interest on cash balances"                                  ,;   
         "Investment activity and Revenue From Investments"           ,;
         "Notes rec'able amortization and Interest income"            ,;
         "Sale of equipment and Gain or loss on the sale of assets"   ,;
         "Service contracts receivable and Service income"            ,;
         "Start up expenses"                                          ,;
         "Term loan amortization and Interest expense"                };
         ID 19 OF oDlg on change(asetfilter(.f.,obrw),setup1(cPandl1,10,oDlg,nNewVar),mmcurrec := gl->(recno()),openfilter := .f.,;
         asetfilter(.f.,obrw),oDlg:show()                             ,;
         setcalc2(obrw,odlg,2)                                        ,;
         fixIt(oDlg,oBrw,oCbx1),setTheOrder(),WhatUsing(oDlg),gl->(dbgotop()),oBrw:setfocus())         ;
         UPDATE

      else      

         cPandl1 := "         < Other Profit And Loss Items >"      

         REDEFINE COMBOBOX OCBX1 VAR cPandl1 ITEMS { "         < Other Profit And Loss Items >",;
         "Amortization of prepaid expenses"                           ,;
         "Credit line financing and Interest expense"                 ,;
         "Due to from owners/affiliate and Interest owners"           ,;
         "Expense as a percent of net income"                         ,;
         "Income tax expense and estimated tax payments"              ,;
         "Interest on cash balances"                                  ,;   
         "Investment activity and Income From Investments"            ,;
         "Notes rec'able amortization and Interest income"            ,;
         "Sale of equipment and Gain or loss on the sale of assets"   ,;
         "Service contracts receivable and Service income"            ,;
         "Start up expenses"                                          ,;
         "Term loan amortization and Interest expense"                };
         ID 19 OF oDlg on change(asetfilter(.f.,obrw),setup1(cPandl1,10,oDlg,nNewVar),mmcurrec := gl->(recno()),openfilter := .f.,;
         asetfilter(.f.,obrw),oDlg:show()                             ,;
         setcalc2(obrw,odlg,2)                                        ,;
         fixIt(oDlg,oBrw,oCbx1),setTheOrder(),WhatUsing(oDlg),gl->(dbgotop()),oBrw:setfocus())         ;
         UPDATE
      endif 



      cItem2 := "    < Driver Calculator >"     

      REDEFINE COMBOBOX OCBX5 VAR cItem2 ITEMS { "    < Driver Calculator >",;
      "Sales, regular"                   ,;
      "Sales by product, customer etc."  ,;
      "Inventory"                        ,;
      "Deposits"                         ,;
      "Partners draw"                    ,;
      "Other assets"                     ,;
      "Depreciation Dept. 1"             ,;
      "Depreciation Dept. 2"             ,;
      "Depreciation Dept. 3"             ,;
      "Depreciation Dept. 4"             ,;
      "Beginning accounts payable"       ,;
      "Beginning accrued expenses"       ,;
      "Beginning other payables"}        ;
      ID 24 OF oDlg on change(getwhichOne(cItem2),setcalc2(obrw,odlg,2),setTheOrder(),asetfilter(.f.,obrw),;
      oBrw:refresh(),oBrw:setfocus(),cItem2 :=  "    < Driver Calculator >",oCbx5:refresh(),.t.)

      cPandl4 := " < Reports >"

      if nfp == .T.
         REDEFINE COMBOBOX OCBX4 VAR cPandl4 ITEMS { " < Reports >",;
         "Cash Flow"                ,;
         "Financial Position"           ,;
         "Program Analysis"  ,;
         "Activities"          };
         ID 50 OF oDlg on change(getCash(oBtn12,oBtn10,oBrw,oDlg,aCol,oBtn4),;
         oBrw:refresh(),oDlg:update(),oBrw:setfocus(),oCbx4:refresh(),.t.)

      else  

         REDEFINE COMBOBOX OCBX4 VAR cPandl4 ITEMS { " < Reports >",;
         "Cash Flow"                ,;
         "Balance Sheets"           ,;
         "Prod./cust. analysis"     ,;
         "Profit and Loss"                  ,;
         "Credit line analysis"}     ;
         ID 50 OF oDlg on change(getCash(oBtn12,oBtn10,oBrw,oDlg,aCol,oBtn4),;
         oBrw:refresh(),oDlg:update(),oBrw:setfocus(),oCbx4:refresh(),.t.)
      endif


      if lusingOnehr == .f.

         if nfp == .T.

            //whatUsing(oDlg)   

            cPandl2 := "   < Revenue >"

            REDEFINE COMBOBOX OCBX2 VAR cPandl2 ITEMS { "   < Revenue >",;
            "Revenue by program" ,;
            "Miscellaneous income"};
            ID 15 OF oDlg on change(asetfilter(.f.,obrw),setup1(cPandl2,10,oDlg,nNewVar),setTheOrder(),oDlg:show(),setcalc2(obrw,odlg,2),openfilter := .f.,asetfilter(.f.,obrw),;
            fixIt(oDlg,oBrw,oCbx1),setTheOrder(),WhatUsing(oDlg),gl->(dbgotop()),oBrw:setfocus());
            Update
         else

            //whatUsing(oDlg)   

            cPandl2 := "   < Sales/Income >"

            REDEFINE COMBOBOX OCBX2 VAR cPandl2 ITEMS { "   < Sales/Income >",;
            "Annual, monthly, collections",;
            "By product/customer/employee etc.",;
            "% completion method",;
            "Miscellaneous income"};
            ID 15 OF oDlg on change(asetfilter(.f.,obrw),setup1(cPandl2,10,oDlg,nNewVar),setTheOrder(),oDlg:show(),setcalc2(obrw,odlg,2),openfilter := .f.,asetfilter(.f.,obrw),;
            fixIt(oDlg,oBrw,oCbx1),setTheOrder(),WhatUsing(oDlg),gl->(dbgotop()),oBrw:setfocus());
            Update
         endif     


         if nfp == .T.

            cPandl3 := "      < Program Costs >"                                 
            REDEFINE COMBOBOX OCBX3 VAR cPandl3 ITEMS { "    < Program Costs >",;
            "As a percentage of revenue",;
            "In detail (33 items)",;
            "By program"};
            ID 13 OF oDlg on change(asetfilter(.f.,obrw),setup1(cPandl3,9,oDlg,nNewVar),oDlg:show(),setTheOrder(),setcalc2(obrw,odlg,2),openfilter := .f.,asetfilter(.f.,obrw),;
            fixIt(oDlg,oBrw,oCbx1),setTheOrder(),WhatUsing(oDlg),gl->(dbgotop()),oBrw:setfocus());
            Update

         else  
            cPandl3 := "      < Cost Of Sales >"
            REDEFINE COMBOBOX OCBX3 VAR cPandl3 ITEMS { "    < Cost Of Sales >",;
            "As a percentage of sales",;
            "In detail (33 items)",;
            "By product/customer/employee etc."};
            ID 13 OF oDlg on change(asetfilter(.f.,obrw),setup1(cPandl3,9,oDlg,nNewVar),oDlg:show(),setTheOrder(),setcalc2(obrw,odlg,2),openfilter := .f.,asetfilter(.f.,obrw),;
            fixIt(oDlg,oBrw,oCbx1),setTheOrder(),WhatUsing(oDlg),gl->(dbgotop()),oBrw:setfocus());
            Update
         endif

         cPandl := "       < Cash Flow And Other Items >"

         if nfp == .T.  
            REDEFINE COMBOBOX OCBX VAR cPandl ITEMS { "         < Cash Flow And Other Items >",;
            "Adjust other assets"                        ,;
            "Beginning financial position"               ,;
            "Beginning payables-payment of same"         ,;
            "Customer deposits"                          ,;
            "Deposits to be made"                        ,;
            "Loans due to/from owners/affiliates"        ,;
            "Loans from others"                          ,;
            "Loans to others"                            ,;
            "Name, fiscal period, plan year "            ,;
            "New borrowings and investor activities"     ,;
            "Purchase of equipment",;
            "Sales tax collection and payment"};
            ID 18 OF oDlg on change(asetfilter(.f.,obrw),setup1(cPandl,9,oDlg,nNewVar),oDlg:show(),setcalc2(obrw,odlg,2),openfilter := .f.,asetfilter(.f.,obrw),;
            fixIt(oDlg,oBrw,oCbx1),setTheOrder(),WhatUsing(oDlg),gl->(dbgotop()),oBrw:setfocus());
            Update

         else  

            REDEFINE COMBOBOX OCBX VAR cPandl ITEMS { "         < Cash Flow And Other Items >",;
            "Adjust other assets",;
            "Beginning balance sheet",;
            "Beginning payables-payment of same",;
            "Customer deposits"                          ,;
            "Deposits to be made", ;
            "Dividends to be paid",;
            "Enter actual products sold", ;
            "Loans due to/from owners/affiliates",;
            "Loans from others",;
            "Loans to others",;
            "Name, fiscal period, plan year ",;
            "New borrowings and investor activities",;
            "Preferred stock/Treasury stock",;
            "Proprietors draw",;
            "Purchase of equipment",;
            "Sales tax collection and payment"};
            ID 18 OF oDlg on change(asetfilter(.f.,obrw),setup1(cPandl,9,oDlg,nNewVar),oDlg:show(),setcalc2(obrw,odlg,2),openfilter := .f.,asetfilter(.f.,obrw),;
            fixIt(oDlg,oBrw,oCbx1),setTheOrder(),WhatUsing(oDlg),gl->(dbgotop()),oBrw:setfocus());
            Update
         endif
      endif 

      //REDEFINE BTNBMP OBMP1  ID 116 OF ODLG   file "TESTBMP2.BMP" 

      oCbx:cToolTip := "To set a trend for an item double click on "+CRLF+"the 'TrendIt' column and"+;
      "enter the amount (%)"+CRLF+" you wish to have the item trend by to future years."

      //REDEFINE BTNBMP OBMP5  ID  21 OF ODLG   file "TESTBMP2.BMP" 

      oBtn3:cToolTip := "Select expense departments to be displayed."+CRLF+;
      "Edit a standard payment assumption for all expenses."

      oBtn5:cTooltip := "All planning options available and a program map"                                     

      * oBmp5:cToolTip := "To edit an expense (cell) left double click on the expense."+CRLF+;
      * "Left click, the following is available: eleven methods for developing the expense. "+CRLF+;
      * "For additional options highlight the expense (cell) then right click on the expense."+CRLF+;
      * "Right click, the following is available:"+CRLF+;
      * "Remove an expense, edit notes, move an expense from one department to another,"+CRLF+;
      * "expense Driver Calculator, allocate the expense to a product, customer etc."


               

      // SHOW EXPLANATION ONY IF NO SALES ENTERED      


      if nNewVar == 1
         oBtn2:hide()
         oBtn3:hide()
         //oBtn4:hide()
         oBtn5:hide()
         oBtn7:hide()
         oCbx4:hide()
         oCbx5:hide()
         oCbx1:hide()
         oCbx2:hide()
         oCbx3:hide()
         oCbx:hide()
      endif

      * mDontShow := .T.
      * small_font := 80   

      if small_font <= 96 .OR. oWnd1:nRight >= 1020
         if mDontShow   
            activate dialog odlg centered on init(oBrw:maximize(),oDlg:maximize(),addsales(oDlg,oBrw),nIndex(nIndex),donotshow(oBtn1,obtn3,oBtn4,oBtn5,oBtn7,oCbx4,oCbx1,oCbx2,oCbx3,oCbx,nNewVar,oBmp1,cFrecast,oBmp5),;
            asetfilter(.f.,obrw),intuit(nNewVar,oBrw,oDlg),gl->(dbgotop()),oBrw:setfocus(),oSay35:hide(),oSay36:hide(),oSay37:hide());
            ON PAINT (Gradpaint0( hDC, oDlg,.t.)  )  
         endif     
      else
         if mDontShow   
            gl->(dbgotop())
            if !EMPTY(cFrecast) .AND. noDisp <> 2   
               activate dialog odlg centered on init(donotshow(oBtn1,obtn3,oBtn4,oBtn5,oBtn7,oCbx4,oCbx1,oCbx2,oCbx3,oCbx,nNewVar,oBmp1,cFrecast,oBmp5),;
               odlg:maximize(),oBrw:maximize(),gl->(dbgotop(),addsales(oDlg,oBrw),nIndex(nIndex),obrw:setfocus()),oBtn9:hide(),oBtn12:hide(),oBrw:setfocus(),asetfilter(.f.,obrw),intuit(nNewVar,oBrw,oDlg),oSay35:hide(),oSay36:hide(),oSay37:hide());
               ON PAINT (Gradpaint0( hDC, oDlg,oBrw )  )  

            elseif EMPTY(cFrecast)                                                                                                                                                                                                                                                               
               activate dialog odlg centered on init(donotshow(oBtn1,obtn3,oBtn4,oBtn5,oBtn7,oCbx4,oCbx1,oCbx2,oCbx3,oCbx,nNewVar,oBmp1,cFrecast,oBmp5),;
               odlg:maximize(),oBrw:maximize(),gl->(dbgotop(),addsales(oDlg,oBrw),nIndex(nIndex),obrw:setfocus()),oBtn9:hide(),oBtn12:hide(),oBrw:setfocus(),asetfilter(.f.,obrw),intuit(nNewVar,oBrw,oDlg),oSay35:hide(),oSay36:hide(),oSay37:hide());
               ON PAINT (Gradpaint0( hDC, oDlg,oBrw )  )  
            elseif !EMPTY(cFrecast) .AND. noDisp == 2                                                                                                                                                                    
               activate dialog odlg centered on init(donotshow(oBtn1,obtn3,oBtn4,oBtn5,oBtn7,oCbx4,oCbx1,oCbx2,oCbx3,oCbx,nNewVar,oBmp1,cFrecast,oBmp5),;
               odlg:maximize(),oBrw:maximize(),gl->(dbgotop(),addsales(oDlg,oBrw),nIndex(nIndex),obrw:setfocus()),oBtn12:hide(),oBrw:setfocus(),asetfilter(.f.,obrw),intuit(nNewVar,oBrw,oDlg),oSay35:hide(),oSay36:hide(),oSay37:hide());
               ON PAINT (Gradpaint0( hDC, oDlg,oBrw )  )  
            endif       

         endif     
      endif
 [
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Coloring a line Solved. Now coloring an individual cell

Postby James Bott » Fri Jan 14, 2011 6:29 pm

Harvey,

I notice a lot of common elements in your code. For instance, you have about 17 sections like this:

Code: Select all  Expand view
    ADD  TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610', ;
      repli(" ",30), trans(Eval(bty7),  ;
      '999,999,999')) ;
      SIZE msize ;
      RIGHT ;  
      HEADER m7+cActl7;
      footer " "

By converting the above to a function you could eliminate 16 of those sections of code since you could then call the function like this:

Code: Select all  Expand view
     cActs:= '2053,2514,2632,2733,2833,2933,2998,3355,3485,4601,4602,4603,4604,4605,4607,4608,4609,4610'
      addBrw( oBrw, cActs, 30, m7+cAct17 )

Here is the function:

Code: Select all  Expand view
function addBrw( oBrw, cActs, nSize, cHeader, cFooter )

   default nSize:=30, cHeader:=" ",cFooter:=" "

     ADD TO oBrw DATA ;
      If( gl->title = '-' .or. gl->title = '=' .or. ;
      gl->account $ cActs, ;
      repli(" ",30), trans(Eval(bty7),  ;
      '999,999,999')) ;
      SIZE nSize ;
      RIGHT ;  
      HEADER cHeader;
      footer cFooter

return nil


I know you are thinking, "if it isn't broke, then don't fix it." Perhaps a good philosophy, but less is more is also a good one. Less code makes the code easier to read and understand and less likely to contain bugs. If you do find a bug in a function, one fix is all that is needed.

At least do consider it for future work.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Coloring a line Solved. Now coloring an individual cell

Postby hag » Fri Jan 14, 2011 7:04 pm

James thanks for the good advice. And code. The code that you want to reduce was suggested by you many years ago. :D
But as life goes on we hopefully get better.
You do me sometimes.


An clue how i can color a cell. Always get bound array acess.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Coloring a line Solved. Now coloring an individual cell

Postby James Bott » Fri Jan 14, 2011 8:00 pm

Harvey,

To color a cell try changing this:

// COLOR SET UP
oBrw:bClrStd := {||{CLR_BLACK,CLR_WHITE},{ If(gl->ty13 < 0, CLR_YELLOW, CLR_WHITE) } }

To this:

// COLOR SET UP
oBrw:bClrStd := {|| If(gl->ty13 < 0, {CLR_BLACK,CLR_YELLOW}, {CLR_BLACK,CLR_WHITE} ) }

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Coloring a line Solved. Now coloring an individual cell

Postby James Bott » Fri Jan 14, 2011 8:13 pm

Harvey,

Or, this is probably what you were trying to do:

oBrw:bClrStd := {|| {CLR_BLACK, If(gl->ty13 < 0, CLR_YELLOW, CLR_WHITE) } }

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Coloring a line Solved. Now coloring an individual cell

Postby hag » Fri Jan 14, 2011 8:28 pm

This colors line which was my first request. It works fine
oBrw:bClrStd := {|| {CLR_BLACK, If(gl->ty13 < 0, CLR_YELLOW, CLR_WHITE) } }

I want to color one field on a certain record.
Roa sent me this but I get error
fixflag1() gets the record.

oBrw:aCols[3]:bClrstd := {||If(fixFlag1(), { CLR_BLACK, CLR_YELLOW },{ CLR_BLACK, CLR_WHITE } ) }
oBrw:aCols[3]:bClrstd := {|| { CLR_BLACK, If( fixFlag1(), CLR_YELLOW, CLR_WHITE ) } }

Error occurred at: 01/13/11, 08:43:25
Error description: Error BASE/1132 Bound error: array access
Args:
[ 1] = A { ... }
[ 2] = N 3


Any ideas?
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Coloring a line Solved. Now coloring an individual cell

Postby James Bott » Fri Jan 14, 2011 11:13 pm

Harvey,

Can we see the first 15 lines of the error that show the line numbers and functions? We need to see where the error is occuring.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Coloring a line Solved. Now coloring an individual cell

Postby James Bott » Fri Jan 14, 2011 11:34 pm

Harvey,

OK, I have recreated your error. This will happen if the column has not yet been defined. When it has not been defined, there is no corresponding array in oBrw, thus the array access error.

So make sure the column you are coloring has been defined, then use this line:

oBrw:aCols[3]:bClrstd := {|| { CLR_BLACK, If( fixFlag1(), CLR_YELLOW, CLR_WHITE ) } }

(Where 3 is the number of the column)

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 53 guests