Color For Listbox

Color For Listbox

Postby acwoo1 » Wed Mar 14, 2012 7:42 am

Hi

Code: Select all  Expand view
 

@ 4, 0.4 LISTBOX oLbx FIELDS art->type, art->reference;
HEADERS "Type", "Ref" ;
FIELDSIZES 10, 65;
SIZE 307, 120 OF oDlg ;
FONT oFont


@ 0.2, 0.4 XBROWSE oBrw ALIAS Alias() OF oChild SIZE 307, 170
Code: Select all  Expand view
 


For XBROWSE, the top of the box is colored, but for LISTBOX, the top of the box is not colored. How to get a colour for listbox ?

Thanks

ACWoo
Using FWH1201 + bcc582 + Harbour
acwoo1
 
Posts: 173
Joined: Tue Nov 10, 2009 10:56 am

Re: Color For Listbox

Postby dutch » Wed Mar 14, 2012 9:33 am

Do you mean "nColorHeader"?
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Color For Listbox

Postby Willi Quintana » Wed Mar 14, 2012 4:29 pm

See this code for TWBROWSE 17 by HDC

Code: Select all  Expand view

   ::nClrBackHead  := GetSysColor( COLOR_BTNFACE )
   ::nClrForeHead  := GetSysColor( COLOR_BTNTEXT )
   ::nClrBackFocus := GetSysColor( COLOR_HIGHLIGHT )
   ::nClrForeFocus := GetSysColor( COLOR_HIGHLIGHTTEXT) // CeSoTech CLR_WHITE


   ::nClrFBack     := ::nClrBackHead  // by CeSoTech
   ::nClrFFore     := ::nClrForeHead  // by CeSoTech

   ::nClrNFBack    := GetSysColor( COLOR_HIGHLIGHT ) // COLOR_BTNSHADOW ) // by CeSoTech
   ::nClrNFFore    := ::nClrForeFocus // by CeSoTech

 
User avatar
Willi Quintana
 
Posts: 1019
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú

Re: Color For Listbox

Postby dutch » Wed Mar 14, 2012 6:31 pm

Code: Select all  Expand view
#define BRW_HEADER nRGB(192,220,255)

   oTbw:bBkColor     := {|nRow,nCol,nStyleLine| if(nStyleLine=0, nBckGrd(oTbw), if(nStyleLine=3 , nRGB( 64, 64, 255 ), BRW_HEADER )) }  
.....

*--------------------*
Function nBckGrd(oBrw)
return iif(iif(!empty(oBrw:cAlias),(oBrw:cAlias)->(OrdKeyNo()), oBrw:KeyNo() ) %2 == 0,nRGB(240,255,255), nRGB(220,235,255))

 


Do you try this?
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Color For Listbox

Postby acwoo1 » Thu Mar 15, 2012 4:02 am

Thanks For Your Help

::nClrBackHead := GetSysColor( COLOR_BTNFACE )
::nClrForeHead := GetSysColor( COLOR_BTNTEXT )
::nClrBackFocus := GetSysColor( COLOR_HIGHLIGHT )
::nClrForeFocus := GetSysColor( COLOR_HIGHLIGHTTEXT) // CeSoTech CLR_WHITE


::nClrFBack := ::nClrBackHead // by CeSoTech
::nClrFFore := ::nClrForeHead // by CeSoTech

::nClrNFBack := GetSysColor( COLOR_HIGHLIGHT ) // COLOR_BTNSHADOW ) // by CeSoTech
::nClrNFFore := ::nClrForeFocus // by CeSoTech

Where do I put the above for oLbx ?

oTbw:bBkColor := {|nRow,nCol,nStyleLine| if(nStyleLine=0, nBckGrd(oTbw), if(nStyleLine=3 , nRGB( 64, 64, 255 ), BRW_HEADER )) }

I tried to change Tbw/Brw to Lbx, but it does not work for oLbx.

Regards
ACWoo
Using Fwh2101+bcc582+Harbour
acwoo1
 
Posts: 173
Joined: Tue Nov 10, 2009 10:56 am

Re: Color For Listbox

Postby Willi Quintana » Thu Mar 15, 2012 3:18 pm

See this example:
Code: Select all  Expand view

...
..
.
       REDEFINE LISTBOX oLbx ;
                FIELDS  MyCampo(oCtasCTes, "tipo"), ;
                        MyCampo(oCtasCTes, "documento"), ;
                        SetFecha(MyCampo(oCtasCTes, "fecha_doc")), ;
                        IF(MyCampo(oCtasCtes, "moneda")="S",STR(MyCampo(oCtasCTes,"monto"),12,2),STR(0,12,2)), ;
                         IF(MyCampo(oCtasCtes, "moneda")="S",STR(MyCampo(oCtasCTes,"saldo"),12,2),STR(0,12,2)), ;
                        IF(MyCampo(oCtasCtes, "moneda")="D",STR(MyCampo(oCtasCTes,"monto"),12,2),STR(0,12,2)), ;
                         IF(MyCampo(oCtasCtes, "moneda")="D",STR(MyCampo(oCtasCTes,"saldo"),12,2),STR(0,12,2)), ;
                        SetFecha(MyCampo(oCtasCTes, "vencimiento")), ;
                        DiasMora(MyCampo(oCtasCtes, "vencimiento"), MyCampo(oCtasCtes, "saldo")), ;
                        If(MyCampo(oCtasCtes,"estado")="A", "ANULADO","") ;
                HEADERS "Tipo", ;
                        "Documento",   ;
                        "Fecha"    ,   ;
                        "Monto S/.",   ;
                        "Saldo S/.",   ;
                        "Monto U$.",   ;
                        "Saldo U$.",   ;
                        "Vencimiento", ;      //
                        "Mora",        ;
                        "Estado";      //                               UltReg(oCtasCtes, oLbx),
                ON CHANGE (EVAL(eDatP), oDat[6]:Refresh() ) ;
                FONT oFont3 ;
                COLOR CLR_BLACK, oApp:nRowParClr ;
                SIZES 30, 155, 105, 115, 115, 115, 115, 115, 40, 10 ;    //     IF(nModo=1,"C","V")
                ON DBLCLICK (VerDocumento(oMySQL , MyCampo(oCtasCtes,"estado"), MyCampo(oCtasCtes,"modo"), MyCampo(oCtasCtes, "fecha_doc"), If(EMPTY(MyCampo(oCtasCtes, "tipo")),"09",MyCampo(oCtasCtes, "tipo")), MyCampo(oCtasCtes, "documento"), MyCampo(oCtasCtes, "documento"),MyCampo(oCtasCtes, "fecha_doc"), MyCampo(oCtasCtes ,"ruc_dni"), nModo), oLbx:SetFocus() ) ;
                ID 151 OF oDlg ;
                MySetBrowse(oLbx,oCtasCTes)
                oLbx:aJustify := {.f.,.f.,.f.,.t.,.t.,.t.,.t.,.f.,.f.,.f.}
                oLbx:nFreeze := 10

                oLbx:bKeyDown      := {|nKey|If(nKey = 46, EliminaCtaTotal(oMySQL , MyCampo(oCtasCTes, 4), MyCampo(oCtasCTes, 5), cDat[ 3], nModo, MyCampo(oCtasCTes,"monto"), MyCampo(oCtasCTes,"saldo") ),), EVAL(eDatCC) }
                oLbx:bRClicked     := {|nRow, nCol|oLbx:lButtonDown(nRow,nCol), AnularCtaCte(oMySQL , oDlg, cDat, oCtasCtes, oCtasPago, nModo, nRow, nCol), EVAL(eDatCC), EVAL(eDatP), oLbx:Refresh(), oLbx:SetFocus() }
                oLbx:nClrBackFocus := oApp:cColor2
                oLbx:nClrForeFocus := { ||If(MyCampo(oCtasCtes,"estado") = "A",CLR_HGRAY,If(MyCampo(oCtasCTes,"saldo") > 0, oApp:HRojo, oApp:HAzul))}
                oLbx:nClrText      := { ||If(MyCampo(oCtasCtes,"estado") = "A",CLR_HGRAY,If(MyCampo(oCtasCTes,"saldo") > 0, oApp:HRojo, oApp:HAzul))}
                oLbx:nClrPane      := { ||IF(oCtasCTes:Recno() % 2 == 0,(oApp:nRowParClr),(oApp:nRowNonClr)) }
                oLbx:nStyle        := nOr( WS_CHILD, WS_HSCROLL, WS_VSCROLL, WS_BORDER, WS_VISIBLE, WS_TABSTOP)
                oLbx:aFooters      := {||{"","","", STR(nTotalMS,12,2), STR(nTotalS,12,2) ,STR(nTotalMD,12,2), STR(nTotalD,12,2),"","Días"}}
                oLbx:lDrawFooters  :=.T.

 
User avatar
Willi Quintana
 
Posts: 1019
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú

Re: Color For Listbox

Postby dutch » Thu Mar 15, 2012 5:55 pm

acwoo1 wrote:Where do I put the above for oLbx ?

oTbw:bBkColor := {|nRow,nCol,nStyleLine| if(nStyleLine=0, nBckGrd(oTbw), if(nStyleLine=3 , nRGB( 64, 64, 255 ), BRW_HEADER )) }

I tried to change Tbw/Brw to Lbx, but it does not work for oLbx.

Regards
ACWoo
Using Fwh2101+bcc582+Harbour

ACWoo,

You must link TWBrowse.LIB for this ::data. It will be override LISTBOX class and change LISTBOX to TWBrowse in RC (if use).
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Color For Listbox

Postby acwoo1 » Fri Mar 16, 2012 3:47 am

Thanks For Your Help

The example changes the colour of the content of the listbox.
I was trying just to change the colour of the header in the listbox.

I don't use RC.

Regards
ACWoo
Using FWH1201+bcc582+Harbour
acwoo1
 
Posts: 173
Joined: Tue Nov 10, 2009 10:56 am

Re: Color For Listbox

Postby dutch » Fri Mar 16, 2012 6:55 am

oTbw:bBkColor := {|nRow,nCol,nStyleLine| if(nStyleLine=0, nBckGrd(oTbw), if(nStyleLine=3 , nRGB( 64, 64, 255 ), BRW_HEADER )) }

nStyleLine=3 (Header)

acwoo1 wrote:Thanks For Your Help

The example changes the colour of the content of the listbox.
I was trying just to change the colour of the header in the listbox.

I don't use RC.

Regards
ACWoo
Using FWH1201+bcc582+Harbour

May help
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Color For Listbox

Postby acwoo1 » Sat Mar 17, 2012 2:22 am

Thanks For Your Help

Code: Select all  Expand view
You must link TWBrowse.LIB for this ::data. It will be override LISTBOX class and change LISTBOX to TWBrowse in RC (if use).


Where do I find TWBrowse.lib ?

Thanks

Regards
ACWoo
Using FWH1201+bcc582+Harbour
acwoo1
 
Posts: 173
Joined: Tue Nov 10, 2009 10:56 am

Re: Color For Listbox

Postby dutch » Sun Mar 18, 2012 4:24 pm

ACWoo,

What is your email?
acwoo1 wrote:Thanks For Your Help

Code: Select all  Expand view
You must link TWBrowse.LIB for this ::data. It will be override LISTBOX class and change LISTBOX to TWBrowse in RC (if use).


Where do I find TWBrowse.lib ?

Thanks

Regards
ACWoo
Using FWH1201+bcc582+Harbour
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Color For Listbox

Postby acwoo1 » Mon Mar 19, 2012 1:06 am

Thanks For Your Help

My email: eddylou89@yahoo.com

Regards

ACWoo
Using FWH1201+bcc582+Harbour
acwoo1
 
Posts: 173
Joined: Tue Nov 10, 2009 10:56 am

Re: Color For Listbox

Postby acwoo1 » Mon Mar 19, 2012 11:57 am

Hi Dutch

Thanks very much for your files.

Regards
ACWoo
acwoo1
 
Posts: 173
Joined: Tue Nov 10, 2009 10:56 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 63 guests