Change Color of xBrowse Column Headers and Footers

Change Color of xBrowse Column Headers and Footers

Postby Rick Lipkin » Thu Jun 16, 2016 12:07 pm

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
User avatar
Rick Lipkin
 
Posts: 2630
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Change Color of xBrowse Column Headers and Footers

Postby FranciscoA » Thu Jun 16, 2016 2:02 pm

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.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2111
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Change Color of xBrowse Column Headers and Footers

Postby ukoenig » Thu Jun 16, 2016 2:43 pm

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
Last edited by ukoenig on Fri Jun 17, 2016 9:09 am, edited 1 time in total.
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: Change Color of xBrowse Column Headers and Footers

Postby Rick Lipkin » Thu Jun 16, 2016 4:27 pm

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
User avatar
Rick Lipkin
 
Posts: 2630
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Change Color of xBrowse Column Headers and Footers

Postby Rick Lipkin » Thu Jun 16, 2016 4:31 pm

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
User avatar
Rick Lipkin
 
Posts: 2630
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Change Color of xBrowse Column Headers and Footers

Postby Rick Lipkin » Thu Jun 16, 2016 4:40 pm

Francisco

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

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2630
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Change Color of xBrowse Column Headers and Footers

Postby cnavarro » Thu Jun 16, 2016 4:47 pm

Rick, try with oBrw:l2007 := .F.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Change Color of xBrowse Column Headers and Footers

Postby Rick Lipkin » Thu Jun 16, 2016 4:55 pm

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
User avatar
Rick Lipkin
 
Posts: 2630
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Change Color of xBrowse Column Headers and Footers

Postby cnavarro » Thu Jun 16, 2016 5:00 pm

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
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Change Color of xBrowse Column Headers and Footers

Postby FranciscoA » Thu Jun 16, 2016 5:08 pm

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
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2111
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Change Color of xBrowse Column Headers and Footers

Postby ukoenig » Thu Jun 16, 2016 5:41 pm

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
Last edited by ukoenig on Wed Dec 23, 2020 6:44 pm, edited 10 times in total.
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: Change Color of xBrowse Column Headers and Footers

Postby Rick Lipkin » Thu Jun 16, 2016 6:09 pm

Thank you ALL !! appreciate your help

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2630
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Change Color of xBrowse Column Headers and Footers

Postby richard-service » Wed Jan 18, 2017 5:39 am

Hi
How to change xBrowse Header character color? I saw it black color.
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 767
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Change Color of xBrowse Column Headers and Footers

Postby Marc Venken » Wed Jan 18, 2017 9:58 am

oBrw4:aCols[2]:bClrHeader := { || { CLR_RED, 155 } }

oBrw4:kleuren:bClrHeader := { || { CLR_GREEN, 155 } } // Col Nr. changed to HeaderName
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1352
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Change Color of xBrowse Column Headers and Footers

Postby ukoenig » Wed Jan 18, 2017 10:04 am

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Ruth, Silvio.Falconi and 17 guests