More on browse.

Post Reply
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

More on browse.

Post by HunterEC »

A couple questions regarding TWBrowse:
1. How can I paint alternate rows in different colors ?
2. Is there a way to display a header/footer as part of the TBrowse dialog ?
3. Paint a cell (field/column) based on the data contents, i.e. outstanding
balances in red ?

Thank you.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: More on browse.

Post by Enrico Maria Giordano »

HunterEC wrote:1. How can I paint alternate rows in different colors ?

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw, lOdd := .F.

    USE TEST

    DEFINE DIALOG oDlg;
           SIZE 400, 400

    @ 0, 0 LISTBOX oBrw FIELDS TEST -> last,;
                               TEST -> first

    oBrw:bLogicLen = { || LastRec() }

    oBrw:lCellStyle = .T.

    oBrw:bSkip = { | nRec | nRec := ( oBrw:cAlias ) -> ( DbSkipper( nRec ) ),;
                            lOdd := If( nRec % 2 = 0, lOdd, !lOdd ),;
                            nRec }

    oBrw:nClrPane = { || If( lOdd, CLR_HRED, CLR_HGREEN ) }

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    CLOSE

    RETURN NIL
EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: More on browse.

Post by Enrico Maria Giordano »

HunterEC wrote:2. Is there a way to display a header/footer as part of the TBrowse dialog ?
No way using TWBrowse, as far as I know. Try other browses (TCBrowse? TXBrowse?).

EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: More on browse.

Post by Enrico Maria Giordano »

HunterEC wrote:3. Paint a cell (field/column) based on the data contents, i.e. outstanding balances in red ?

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw

    USE TEST

    DEFINE DIALOG oDlg;
           SIZE 400, 400

    @ 0, 0 LISTBOX oBrw FIELDS TEST -> last,;
                               TEST -> first

    oBrw:bLogicLen = { || LastRec() }

    oBrw:nClrPane = { | nCol | If( nCol = 1 .AND. FIELD -> last = "A", CLR_HRED, CLR_HGREEN ) }

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    CLOSE

    RETURN NIL
EMG
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Post by HunterEC »

Enrico: thank you very much for your help. On your last example all cells are painted green. Is there some sort on bug or I am missing something ? (I am compiling with xHarbour). Thank you.
Post Reply