FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour color cells within a column in an xbrowse.
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM

color cells within a column in an xbrowse.

Posted: Thu Oct 08, 2009 02: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
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM

Re: color cells within a column in an xbrowse.

Posted: Thu Oct 08, 2009 07:02 PM
Hola amigo...
Prueba lo siguiente:

Code (fw): Select all Collapse
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
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM

Re: color cells within a column in an xbrowse.

Posted: Thu Oct 08, 2009 07:26 PM

Amigo.
Thanks
I'll try later today.
And let you know.

Thank you

Harvey
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM

Re: color cells within a column in an xbrowse.

Posted: Fri Oct 09, 2009 01: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
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM

Re: color cells within a column in an xbrowse.

Posted: Fri Oct 09, 2009 02:04 AM
Hola...
Mira esto...

Code (fw): Select all Collapse
   ...
   ...
聽 聽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)}

   ...
   ...




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
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM

Re: color cells within a column in an xbrowse.

Posted: Fri Oct 09, 2009 04:14 AM
Got it working fine.

Put this code in the column.
Code (fw): Select all Collapse
 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
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM

Re: color cells within a column in an xbrowse.

Posted: 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

Continue the discussion