More on browse.

More on browse.

Postby HunterEC » Sun Jun 01, 2008 7:22 am

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.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: More on browse.

Postby Enrico Maria Giordano » Sun Jun 01, 2008 3:16 pm

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


Code: Select all  Expand view
#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: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: More on browse.

Postby Enrico Maria Giordano » Sun Jun 01, 2008 3:18 pm

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: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: More on browse.

Postby Enrico Maria Giordano » Sun Jun 01, 2008 3:28 pm

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


Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby HunterEC » Tue Jun 03, 2008 2:50 pm

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.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Postby Enrico Maria Giordano » Tue Jun 03, 2008 3:39 pm

You have to use FWH 8.05.

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


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 6 guests