FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TWBrowse: cellstyle
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
TWBrowse: cellstyle
Posted: Thu Jan 12, 2012 08:51 AM
Hi,
in your opinion is it possible to obtain this effect?



I need oBrw:lCellStyle = .T. but I need to facilitate the vision of the entire record

Is there any solution even by changing the class?

Many thanks

marco
Marco Boschi
info@marcoboschi.it
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: TWBrowse: cellstyle
Posted: Thu Jan 12, 2012 09:55 AM

No, you have to use at least TCBrowse.

EMG

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: TWBrowse: cellstyle
Posted: Thu Jan 12, 2012 10:06 AM

EMG,
thanks
If I remember correctly TCBrowse is slower

Marco Boschi
info@marcoboschi.it
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: TWBrowse: cellstyle
Posted: Thu Jan 12, 2012 10:33 AM

Yes, it can be slower as each column is an object.

EMG

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: TWBrowse: cellstyle
Posted: Thu Jan 12, 2012 02:10 PM
Marco

I did something similar to this in an old app of mine using the Standard FWH Listbox class and it was based on the column.

For some reason this logic failed for me after version 9.10 and I changed this over to xBrowse .. If there is anything relevant here you can use .. let me know.

Rick Lipkin

Code (fw): Select all Collapse
DEFINE WINDOW oWnd1                        ;
      FROM 1,1 to 30,110                   ;
      TITLE cTITLE                         ;
      MENU ProjMenu(oRsProj, oWndMdi)      ;
      ICON oICO                            ;
      NOMINIMIZE                           ;
      NOZOOM                               ;
      MDICHILD

@ 0, 0 LISTBOX oBrw FIELDS                 ;
       oRsProj:Fields("PROJNAME"):Value,   ;
       substr(oRsProj:Fields("descrip"):Value,1,25),;
       oRsProj:Fields("reporting"):Value,;
       oRsProj:Fields("projmgr"):Value,    ;
       IF(EMPTY(oRsProj:Fields("start_date"):Value), dtoc(ctod("")), oRsProj:Fields("start_date"):Value),;
       IF(EMPTY(oRsProj:Fields("end_date"):Value), dtoc(ctod("")), oRsProj:Fields("end_date"):Value),;
       transform(oRsProj:Fields("est_budget"):Value,"999,999,999.99"),;
       oRsProj:Fields("frequency"):Value,   ;
       IF(EMPTY(oRsProj:Fields("row_color"):Value),"NO STATUS", oRsProj:Fields("row_color"):Value);
       SIZES 130,183,30,85,85,85,85,90,90  ;
       HEADERS "Proj Name",                ;
               "Description",              ;
               "CRpt",                     ;
               "ProjMgr",                  ;
               "Orig Start Dt",            ;
               "Orig End Date",            ;
               "Orig Est Budget",          ;
               "Frequency",                ;
               "Last Status"               ;
       ON DBLCLICK( _ProjView( "V", oRsProj,"","" ) ) ;
       UPDATE

       oBrw:bLogicLen := { || oRsProj:RecordCount }
       oBrw:bGoTop    := { || oRsProj:MoveFirst() }
       oBrw:bGoBottom := { || oRsProj:MoveLast() }
       oBrw:bSkip     := { | nSkip | Skipper( oRsProj, nSkip ) }
       oBrw:cAlias    := "ARRAY"


       // paint the row colors active and status column  //
       obrw:nClrText      := { |nCOL| SelColorF( nCOL, oRsProj:Fields("row_color"):Value, oRsProj:Fields("active"):Value, "F" ) }
       oBrw:nClrPane      := { |nCOL| SelColorB( nCOL, oRsProj:Fields("row_color"):Value, oRsProj:Fields("active"):Value, "B" ) }
    //   oBrw:nClrForeFocus = { |nCOL| SelColorH( nCOL, oRsProj:Fields("row_color"):Value, oRsProj:Fields("active"):Value, "F" ) }
       oBrw:nClrBackFocus := { |nCOL| SelColorH( nCOL, oRsProj:Fields("row_color"):Value, oRsProj:Fields("active"):Value, "B" ) }

       oWND1:oClient := oBRW
       oWND1:SetControl( oBrw )

ACTIVATE WINDOW oWND1 ;
         ON INIT( IF( lFROMLINK = .T., (_ProjView( "V", oRsProj,"", lFROMLINK  )), ));
         VALID ( IIF( !lOK, _ProjClose(.T.), .F. ))

RETURN( .T. )

//-------------------------------
STATIC FUNCTION SKIPPER( oRsx, nSkip )

LOCAL nRec := oRsx:AbsolutePosition

oRsx:Move( nSkip )

IF oRsx:EOF; oRsx:MoveLast(); ENDIF
IF oRsx:BOF; oRsx:MoveFirst(); ENDIF

RETURN( oRsx:AbsolutePosition - nRec )

//-----------------------------------------------
Static Func SelColorB( nCOL, cCOLOR, cACTIVE, cTYPE )

LOCAL nCOLOR := CLR_WHITE

// background for all cells

DO CASE
CASE nCOL < 9
   IF cACTIVE = 'Y'
      nCOLOR := CLR_WHITE
   ELSE
      nCOLOR := RGB(179,203,204)     // light blue
   ENDIF

CASE nCOL = 9 .and. cCOLOR = "GREEN" .and. cTYPE = "B"
     nCOLOR := CLR_HGREEN

CASE nCOL = 9 .and. cCOLOR = "YELLOW".and. cTYPE = "B"
     nCOLOR := CLR_YELLOW

CASE nCOL = 9 .and. cCOLOR = "RED"   .and. cTYPE = "B"
     nCOLOR := CLR_HRED

ENDCASE

RETURN( nCOLOR )

//--------------------
Static Func SelColorF( nCOL, cCOLOR, cACTIVE, cTYPE )

LOCAL nCOLOR := CLR_BLACK

// forground for all cells

IF EMPTY(nCOL) .or. nCOL = NIL
   nCOL := 8
ENDIF

DO CASE
CASE nCOL < 9
     IF cACTIVE = 'Y'
        nCOLOR := CLR_BLACK
     ELSE
        nCOLOR := CLR_BLACK // RGB(255,0,0 )        // red
     ENDIF

CASE nCOL = 9 .and. cCOLOR = "GREEN" .and. cTYPE = "F"
     nCOLOR := CLR_BLACK

CASE nCOL = 9 .and. cCOLOR = "YELLOW".and. cTYPE = "F"
     nCOLOR := CLR_BLACK

CASE nCOL = 9 .and. cCOLOR = "RED"   .and. cTYPE = "F"
     nCOLOR := CLR_BLACK

ENDCASE

RETURN( nCOLOR )

//-----------------------------------------------
Static Func SelColorH( nCOL, cCOLOR, cACTIVE, cTYPE )

// background for hi-lite bar

LOCAL nCOLOR := CLR_HGRAY

DO CASE
CASE nCOL < 9
   IF cACTIVE = 'Y'
      nCOLOR := rgb( 122,122,122 ) //CLR_HGRAY
   ELSE
      nCOLOR := RGB(179,203,204)     // light blue
   ENDIF

CASE nCOL = 9 .and. cCOLOR = "GREEN" .and. cTYPE = "B"
     nCOLOR := CLR_HGREEN

CASE nCOL = 9 .and. cCOLOR = "YELLOW".and. cTYPE = "B"
     nCOLOR := CLR_YELLOW

CASE nCOL = 9 .and. cCOLOR = "RED"   .and. cTYPE = "B"
     nCOLOR := CLR_HRED

ENDCASE

RETURN( nCOLOR )
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: TWBrowse: cellstyle
Posted: Thu Jan 12, 2012 02:58 PM

Rick,
I use cellstyle := .T.

Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: TWBrowse: cellstyle SOLVED
Posted: Tue Jan 17, 2012 10:02 AM
In wbrowse.prg


Code (fw): Select all Collapse
//          if nColAct != nil .and. n == nColAct
//             SetTextColor( hDC, nClrText )
//             SetBkColor( hDC, nClrPane )

         if nColAct != nil
            IF n == nColAct
               SetTextColor( hDC, nClrText )
               SetBkColor( hDC, nClrPane )
            ELSE
               SetTextColor( hDC, RGB( 240 ,  60 ,  60 ) )
               SetBkColor( hDC, RGB( 233, 233, 235 )  ) // il resto della riga

//                SetTextColor( hDC, nClrPane )
//                SetBkColor( hDC, nClrText  ) // il resto della riga


now it's easy to read in a big browse
bye
Marco Boschi
info@marcoboschi.it
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Re: TWBrowse: cellstyle
Posted: Tue Jan 17, 2012 11:59 AM

someone have the source of last twbrowse? working with harbour and xharbour (cvs)

thanks

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: TWBrowse: cellstyle
Posted: Wed Jan 18, 2012 10:15 AM

Norberto,
Last versions don't contain source code?
the file wbrowse.prg that I've modified is dated 2009 october

Marco Boschi
info@marcoboschi.it

Continue the discussion