XBROWSE cell color change / problems

XBROWSE cell color change / problems

Postby TimStone » Fri Jan 08, 2016 4:38 pm

Sorry to ask so many questions on xBrowse but I do check the documentation and notes and forum first ... ( Perhaps we could get the documentation on the wiki updated to show the full current use of XBROWSE ? )

Here is my question.

I have an xbrowse with 10 columns. #7 is the DueDate for a project. When the item is overdue, I want to change the color in that cell only to red. Otherwise I want to leave it alone.

What command will allow me to do this for IF duedat < date( )

I have tried some variations suggested in earlier, similar, posts ... no success

Here is another problem:

When using the COMMAND syntax, then adding oBrw:lHScroll := .t. to a browse in a .rc file, the horizontal scroll bar does NOT display. If I go to the .rc file and add it to the control, it will display. So, it may work when building from code, but not when applied to a resource file ...
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: XBROWSE cell color change / problems

Postby ukoenig » Fri Jan 08, 2016 9:25 pm

Tim

I'm using 2 functions ( cell-background and text )
because it is still needed on other places.
You can pass any other logic to the functions

I will test using only one function that returns a array

Image

Just a sample :

Code: Select all  Expand view


#include 'fivewin.ch'
#include 'xbrowse.ch'

request DBFCDX

function main()
local oDlg, oBrw, oCol

USE CUSTOMER SHARED VIA "DBFCDX"

DEFINE DIALOG oDlg SIZE 500,400 PIXEL
 
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" ;        
COLUMNS "Age", "First", "Last", "Hiredate" ;
CELL LINES FASTEDIT NOBORDER

oBrw:Hiredate:bClrStd := {|| { CELL_COL1("CUSTOMER"), CELL_COL2("CUSTOMER") } }
oBrw:CreateFromCode()

ACTIVATE DIALOG oDlg CENTERED

return nil

// --------------

FUNCTION CELL_COL1(cDatabase)
LOCAL nColor1 := CLR_BLUE // Text-color of not selected fields

IF (cDatabase)->Hiredate > CTOD("12/11/90")
   nColor1 := CLR_WHITE
ENDIF

RETURN ( nColor1 )

// --------------

FUNCTION CELL_COL2(cDatabase)
LOCAL nColor2 := CLR_WHITE // Basic cell-background

IF (cDatabase)->Hiredate > CTOD("12/11/90")
   nColor2  := CLR_HRED // Background-cellcolor of selected fields
ENDIF

RETURN ( nColor2 )
 


best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: XBROWSE cell color change / problems

Postby TimStone » Fri Jan 08, 2016 9:48 pm

Thanks. I've got that working now.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: XBROWSE cell color change / problems

Postby joseluisysturiz » Sat Jan 09, 2016 12:09 am

This is Mr.Daniel, saludos... :shock:

Code: Select all  Expand view

   FOR nFor = 6 to LEN( oBrw:aCols )
      oBrw:aCols[ nFor ]:bClrStd := ChangeColor( oBrw, nFor )
   NEXT

FUNCTION ChangeColor( oBrw, n ) //
***RETURN {|| { ColorCell( oBrw:aRow[ n ] ), ColorCell( oBrw:aRow[ n ] ) } } // TEXTO MISMO COLOR DE CELDA
RETURN {|| { ColorCell( oBrw:aCols[ n ]:Value ), ColorCell( oBrw:aCols[ n ]:Value ) } }

FUNCTION ColorCell( uDato ) // DEVUELVE COLOR SEGUN STATUS FORMA PAGO CUOTA
   LOCAL nColor
// EXTRAIGO VALOR NUMERICO DE CUOTAS YA QUE TAMBIEN ESTA 3 LETRAS DEL MES QUE SE PAGO(ejm.03NOV)
* uDato := val( SUBST( uDato,2 ) )

   DO CASE
      CASE uDato == 1 // AMARILLO-PAGADAS AL DIA
         nColor := RGB(255, 255, 128)

      CASE uDato == 2 // AZUL-PAGADAS ADELANTADAS
         nColor := RGB(0, 100, 200)

      CASE uDato == 3 // MARRON CLARO-PAGADAS CON ATRASO
         nColor := RGB(255, 172, 89)

      CASE uDato == 9 // ROJO-CUOTAS VENCIDAS
         nColor := RGB(240, 0, 0)

      OTHERWISE
         nColor := GetSysColor( 5 )

   ENDCASE

RETURN nColor
 
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 114 guests