Page 1 of 2

Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 12:07 pm
by Rick Lipkin
To All

I am re-working a legacy FWH app and I am going with an all 'grey' color scheme. I would like to be able to change the color of the standard light blue for the column headers and footers of xBrowse to a light grey if that is possible.

Many Thanks
Rick Lipkin

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 2:02 pm
by FranciscoA
Hi, Rick.
Try this partial code.
Code: Select all  Expand view

STATIC bClrGradBtn

//--------------
Function Main()

SetDlgGradient( { { 1, RGB( 255, 255, 255 ), RGB( 229, 233, 238 ) } } )

bClrGradBtn := { | lPressed | If( ! lPressed,;   //Plomo
                 { { 1, RGB( 255, 255, 255 ), RGB( 229, 233, 238 ) } },;
                 { { 1, RGB( 194, 197, 201 ), RGB( 240, 240, 240 ) } } ) }


//-----------------------
Function xxx()

   @ .5, .5 XBROWSE oBrw SIZE 544,254 OF oDlg ;
            ALIAS cAlias AUTOCOLS CELL LINES

   oBrwStyle(oBrw)

   oBrw:CreateFromCode()

   @ nHt-15, 10 BTNBMP oBt1 PROMPT "Nuevo"    SIZE 35,12 PIXEL OF oDlg RESOURCE "NEW16X16"    LEFT NOBORDER ;
                ACTION xAction()
   @ nHt-15, 48 BTNBMP oBt2 PROMPT "&Modific "  SIZE 35,12 PIXEL OF oDlg RESOURCE "EDIT16X16"   LEFT NOBORDER ;
                ACTION yAction()
   @ nHt-15,162 BTNBMP oBt5 PROMPT "&Salir  "   SIZE 35,12 PIXEL OF oDlg RESOURCE "SALIR16X16"  LEFT NOBORDER ;
                ACTION (oDlg:End())

   BtnDegrad(oDlg)  //Botones degradados (BTNBMP)

  ACTIVATE DIALOG oDlg CENTERED
return nil


//-----------------------------
Function oBrwStyle(oBrw)
Local aRowGrad     := { { .5, nRGB( 255, 255, 255 ), nRGB( 240, 240, 240 ) }, ;
                           { .5, nRGB( 240, 240, 240 ), nRGB( 232, 232, 232 ) } }
Local aSelGrad      := { { .5, RGB( 255, 255, 180 ), RGB( 255, 237, 178 ) }, ;
                           { .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }

WITH OBJECT  oBrw              
  :nColDividerStyle := 5
  :nMarqueeStyle    := 5 //MARQSTYLE_HIGHLCELL
  :nColorPen        := Rgb( 225, 225, 225 )
  :nRecSelColor     := nRGB( 240, 240, 240 )
  :bClrSel          := { || { CLR_BLACK, RGB( 255, 255, 255 ) } }
  :bClrSelFocus     := { || { CLR_BLACK, aSelGrad } }
  :bClrRowFocus     := { || { CLR_BLACK, aRowGrad } }
  :bClrGrad         := { | lInvert | If( !lInvert,  { { 0.5, nRGB( 255, 255, 255 ), nRGB( 240, 240, 240 ) }, ;
                         { 0.5, nRGB( 240, 240, 240 ), nRGB( 232, 232, 232 ) } },;
                         { { 0.50, 12961221, 16777215 }, { 0.50, 16777215, 12961221 } } ) }
  :bClrHeader       := {|| { CLR_BLUE, nRGB( 245, 245, 245 ) } }
  :bClrFooter       := {|| { CLR_BLUE, 16777215 } }
  :lAllowRowSizing  := .f.
  :lAllowColSwapping := .f.
  :lAllowColHiding   := .f.          
  :lKinetic          := .f.
  :lColDividerComplete := .t.
  :lFooter   := .t.
  :nHeaderHeight     := 24
  :nFooterHeight     := :nHeaderHeight
END
Return nil

//------------------------
Function BtnDegrad(oWn)
local n
if bClrGradBtn != NIL
   For n:=1 to len(oWn:aControls)
       if oWn:aControls[n]:ClassName()=="TBTNBMP"
          oWn:aControls[n]:bClrGrad = bClrGradBtn
       endif
   Next
endif
Return nil
 

Regards.

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 2:43 pm
by ukoenig
Rick,

xBrowse Header and Footer with gradient light grey

oBrw1:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 0.50, 14342874, 16777215 }, ;
{ 0.50, 16777215, 14342874 } }, ;
{ { 0.50, 14342874, 16777215 }, ;
{ 0.50, 16777215, 14342874 } } ) }
// default colour gradient spec


some grey-values to replace 14342874 ( very light grey ) :
16777215 = white

11250603
12632256
13684944
15066597


Image

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 4:27 pm
by Rick Lipkin
Uwe

Thank you .. I am playing with the colors .. without making all the values the same .. is there a way to just make the color a solid light grey without any gradient ?

Rick Lipkin

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 4:31 pm
by Rick Lipkin
Francisco

Thank you for your suggestion .. going to try your solution :
Code: Select all  Expand view

:bClrHeader       := {|| { CLR_BLUE, nRGB( 245, 245, 245 ) } }
:bClrFooter       := {|| { CLR_BLUE, 16777215 } }
 


Rick Lipkin

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 4:40 pm
by Rick Lipkin
Francisco

Unfortunately the above interpretation of your solution did not work .. still have the light blue headers and footers :(

Rick Lipkin

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 4:47 pm
by cnavarro
Rick, try with oBrw:l2007 := .F.

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 4:55 pm
by Rick Lipkin
Cristobol and Uwe

Both of these solutions worked ..

Code: Select all  Expand view

 oLbx:l2007 := .F.   // light grey
 


Uwe .. Your solution allows control over the color
Code: Select all  Expand view
 
oLbx:bClrGrad := { | lInvert | If( ! lInvert, ;
                                         { { 0.50, 15790320, 15790320 }, ;
                                         { 0.50,   15790320, 15790320 } }, ;
                                         { { 0.50, 15790320, 15790320 }, ;
                                         { 0.50,   15790320, 15790320 } } ) }
 


Thank you ALL for your ideas, inspiration, and solutions !
Rick Lipkin

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 5:00 pm
by cnavarro
Rick Lipkin wrote:Francisco

Thank you for your suggestion .. going to try your solution :
Code: Select all  Expand view

:bClrHeader       := {|| { CLR_BLUE, nRGB( 245, 245, 245 ) } }
:bClrFooter       := {|| { CLR_BLUE, 16777215 } }
 


Rick Lipkin


Rick, code of Francisco with oBrw:l2007 := .F., have to work well

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 5:08 pm
by FranciscoA
Rick, please try this way. (As Cristobal said)

is there a way to just make the color a solid light grey without any gradient ?

Code: Select all  Expand view
//------------------------
Function FapBrwSetup(oBrw)
local nFONDO1 := RGB(215, 215, 215)
local nFONDO2 := RGB(235, 235, 235)
local nAZUL   := RGB( 0, 0, 128)

   WITH OBJECT oBrw
      :l2007            := .f.
      :nRecSelColor     :=  nFONDO1
      :nStyle           := nAnd( :nStyle, nNot( WS_BORDER ) )
      :nMarqueeStyle    := MARQSTYLE_HIGHLROW   //ilumina toda la linea
      :bClrHeader       := {|| { nAZUL, nFONDO1, } }
      :bClrFooter       := :bClrHeader         // Colores texto de footers
      :bClrStd          := {|| IF( oBrw:nArrayAt() % 2 == 0, {nAZUL, nFONDO1}, {nAZUL, nFONDO2} ) }  
      :bClrSel          := {|| { nAZUL, CLR_WHITE } }  // para barra de linea selecc cuando el control no tiene el foco
      :bClrSelFocus     := { || { CLR_WHITE, nAZUL } }     // para barra de linea selecc cuando el control tiene el foco
      :nColDividerStyle := LINESTYLE_LIGHTGRAY
      :nRowDividerStyle := LINESTYLE_LIGHTGRAY
   END
Return nil

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 5:41 pm
by ukoenig
Rick,

Image

a setting for header AND footer
oBrw1:l2007 := .T.

1 // gradient
oBrw1:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 0.50, 14342874, 16777215 }, ;
{ 0.50, 16777215, 14342874 } }, ;
{ { 0.50, 14342874, 16777215 }, ;
{ 0.50, 16777215, 14342874 } } ) } // default colour gradient spec

2
// single color with ( 4 same color defines )
oBrw1:bClrGrad := { || { { 0.1, 14342874, 14342874 }, ;
{ 0.1, 14342874, 14342874 } } }

------------------------
------------------------

3 + 4
bClrHeader and bClrFooter You can use to color a single column
otherwise You can use AEval(... for ALL columns

oBrw1:l2007 := .F..
AEval( oBrw1:aCols, { |o| o:bClrHeader := { || { CLR_BLUE, 14342874 } } } )
AEval( oBrw1:aCols, { |o| o:bClrFooter := { || { CLR_BLUE, 14342874 } } } )

5
colering a single column-header ( column 2 )
oBrw1:aCols[2]:bClrHeader := { || { CLR_BLUE, 255 } }

regards
Uwe :D

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Thu Jun 16, 2016 6:09 pm
by Rick Lipkin
Thank you ALL !! appreciate your help

Rick Lipkin

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Wed Jan 18, 2017 5:39 am
by richard-service
Hi
How to change xBrowse Header character color? I saw it black color.

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Wed Jan 18, 2017 9:58 am
by Marc Venken
oBrw4:aCols[2]:bClrHeader := { || { CLR_RED, 155 } }

oBrw4:kleuren:bClrHeader := { || { CLR_GREEN, 155 } } // Col Nr. changed to HeaderName

Re: Change Color of xBrowse Column Headers and Footers

PostPosted: Wed Jan 18, 2017 10:04 am
by ukoenig
or include

Code: Select all  Expand view

WITH OBJECT oBrw
     
     :bClrHeader := { || { 255, } } // red text and keeps the background
     // same for footer
     :bClrFooter := { || { 255, } } // red text and keeps the background  

END
 


regards
Uwe :D