color cells within a column in an xbrowse.

color cells within a column in an xbrowse.

Postby hag » Thu Oct 08, 2009 2:24 pm

I have a 14 column xbrowse. There are 200 records being displayed.
In the first coulmn only I want to color records 1 to 20 one color and records 21-30 another color and records 31-50 another color. Just in the first column.
Using harbour, and resources.

Struggling for several hours but can't get it working.

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

Re: color cells within a column in an xbrowse.

Postby jrestojeda » Thu Oct 08, 2009 7:02 pm

Hola amigo...
Prueba lo siguiente:

Code: Select all  Expand view

oBrw:aCols[1]:bClrStd:={||IF((oDbf:CODIGO>=1 .AND. oDbf:CODIGO<= 5),{RGB(0,0,0),RGB(255,0,0)},;
                          IF((oDbf:CODIGO>=6 .AND. oDbf:CODIGO<=10),{RGB(0,0,0),RGB(0,255,0)},{RGB(0,0,0),RGB(0,0,255)}))}
 


Espero te sirva.
Saludos desde Argentina, Esteban.
Ojeda Esteban Eduardo.
Buenos Aires - Argentina.
FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport
Skype: jreduojeda
User avatar
jrestojeda
 
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Re: color cells within a column in an xbrowse.

Postby hag » Thu Oct 08, 2009 7:26 pm

Amigo.
Thanks
I'll try later today.
And let you know.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: color cells within a column in an xbrowse.

Postby hag » Fri Oct 09, 2009 1:20 am

Tried it and I get error message bound array access. I don't know how to get the aCols[1] array. Help. Again useing harbour and resources. Browse not created from code.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: color cells within a column in an xbrowse.

Postby jrestojeda » Fri Oct 09, 2009 2:04 am

Hola...
Mira esto...

Code: Select all  Expand view

   ...
   ...
   oLbx:nRowDividerStyle   :=5
   oLbx:nColDividerStyle   :=5
   oLbx:nMarqueeStyle      :=5
   oLbx:nHeaderLines       :=2
   oLbx:nFooterLines       :=1
   oLbx:nDataType          :=1
   oLbx:nDataLines         :=1
   oLbx:nRowSel            :=1
   oLbx:nFreeze            :=2
   oLbx:nRowHeight         :=25
   oLbx:CreateFromResource(100)  // xBrowse creado desde recursos.
   oLbx:lFooter            :=.t.
   oLbx:bClrSelFocus       :={||{AzulB,RGB(176,196,222 )}}
   oLbx:bLDblClick         :={||ABMClientes(oLbx,oWnd,oWnd1,13)}
   oLbx:bRClicked          :={|nRow,nCol| BotonDerechoClientes(nRow,nCol,oLbx,oWnd,oWnd1,Empresa)}

   oLbx:AddCol():bEditValue    :={ || STR((cAlias)->CODIGO) }
   oLbx:aCols[ 1]:cSortOrder   :="CLIENT1"
   oLbx:aCols[ 1]:nWidth       :=80
   oLbx:aCols[ 1]:cHeader      :="Código"
   oLbx:aCols[ 1]:nDataStrAlign:=1
   oLbx:aCols[ 1]:nHeadStrAlign:=2
   oLbx:aCols[ 1]:oHeaderFont  :=oFont2
   oLbx:aCols[ 1]:oDataFont    :=oFont1
   oLbx:aCols[ 1]:bLClickHeader:={|| RefreshSayClientes(oLbx,oSay,@vSay,1)}
   oLbx:aCols[ 1]:bClrStd      :={||IF((oDbf:CODIGO>=1 .AND. oDbf:CODIGO<= 5),{RGB(0,0,0),RGB(255,0,0)},;
                          IF((oDbf:CODIGO>=6 .AND. oDbf:CODIGO<=10),{RGB(0,0,0),RGB(0,255,0)},{RGB(0,0,0),RGB(0,0,255)}))}
 
   oLbx:AddCol():bEditValue    :={ || (cAlias)->NOMBRE }
   oLbx:aCols[ 2]:cSortOrder   :="CLIENT2"
   oLbx:aCols[ 2]:nWidth       :=350
   oLbx:aCols[ 2]:cHeader      :="Nombre o razón social"
   oLbx:aCols[ 2]:nDataStrAlign:=0
   oLbx:aCols[ 2]:nHeadStrAlign:=2
   oLbx:aCols[ 2]:oHeaderFont  :=oFont2
   oLbx:aCols[ 2]:oDataFont    :=oFont1
   oLbx:aCols[ 2]:bLClickHeader:={|| RefreshSayClientes(oLbx,oSay,@vSay,2)}

   ...
   ...
 


Image

Como verás ese código me funciona correctamente. Sólo estoy mostrando el código de dos columnas pero son varias columnas más y obviamente el xBrowse esta traído desde recursos.

Espero te sirva.
Saludos, Esteban
Ojeda Esteban Eduardo.
Buenos Aires - Argentina.
FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport
Skype: jreduojeda
User avatar
jrestojeda
 
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Re: color cells within a column in an xbrowse.

Postby hag » Fri Oct 09, 2009 4:14 am

Got it working fine.

Put this code in the column.
Code: Select all  Expand view
ADD COLUMN TO xBROWSE oBrw ;
            SIZE 3  LEFT COLOR {||IF((glnew->account >= "1500" .AND. glnew->account <= "2040"),{RGB(0,0,0),RGB(128,0,0)},;
                                  IF((glnew->account >= "2055" .AND. glnew->account <= "2500"),{RGB(0,0,0),RGB(0,0,128)},;
                                  IF((glnew->account >= "2520" .AND. glnew->account <= "2625"),{RGB(0,0,0),RGB(0,128,0)},;
                                  IF((glnew->account >= "2635" .AND. glnew->account <= "2720"),{RGB(0,0,0),RGB(0,128,128)},;
                                  IF((glnew->account >= "2735" .AND. glnew->account <= "2820"),{RGB(0,0,0),RGB(128,0,0)},;
                                  IF((glnew->account >= "2835" .AND. glnew->account <= "2920"),{RGB(0,0,0),RGB(128,128,0)},;
                                  IF((glnew->account >= "3000" .AND. glnew->account <= "3353"),{RGB(0,0,0),RGB(0,0,255)},;
                                  IF((glnew->account >= "3360" .AND. glnew->account <= "3480"),{RGB(0,0,0),RGB(0,0,255)},;
                                  IF((glnew->account >= "3491" .AND. glnew->account <= "3544"),{RGB(0,0,0),RGB(255,255,0)},;
                                  IF((glnew->account >= "2935" .AND. glnew->account <= "2996"),{RGB(0,0,0),RGB(0,255,0)},;
                                  {RGB(0,0,0),RGB(255,255,255)}))))))))))}
 


Worked perfectly.

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

Re: color cells within a column in an xbrowse.

Postby jrestojeda » Fri Oct 09, 2009 12:47 pm

Perfecto!! :D
Ojeda Esteban Eduardo.
Buenos Aires - Argentina.
FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport
Skype: jreduojeda
User avatar
jrestojeda
 
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 91 guests