FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TO ANTONIO Windows Seven Xbrowse Colores
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
TO ANTONIO Windows Seven Xbrowse Colores
Posted: Fri Apr 02, 2010 06:42 PM

I use a sample of Antonio to show

AEval( oBrw:aCols, { |oCol| ;
oCol:bPaintText := { |oCol, hDC, cData, aRect | ;
PaintCol( oCol, hDC, cData, aRect, nRecSel ) } ;
} )

and then some corrections bug of Daniel viewtopic.php?p=95369#p95708

But I wish have also colors on each row made with this function

STATIC FUNCTION Colores(cdbf)
LOCAL aCol:={}

IF (cdbf)->(Ordkeyno()) % 2 == 0
aCol:={CLR_BLACK, RGB(193,221,255) }
ELSE
aCol:={CLR_BLACK, RGB(221,245,255) }
ENDIF

RETURN (aCol)

FWH .. BC582.. xharbour
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: Windows Seven Xbrowse Colores
Posted: Thu Apr 08, 2010 08:17 AM

Antonio please any solution ?

FWH .. BC582.. xharbour
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TO ANTONIO Windows Seven Xbrowse Colores
Posted: Thu Apr 08, 2010 10:36 AM

Mda,

En PaintCol() debes estar llamando a GradientFill().

Cambia los colores que le pasas a GradientFill() usando tu If()

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: TO ANTONIO Windows Seven Xbrowse Colores
Posted: Thu Apr 08, 2010 11:23 AM

I not understood
Where please ?

include 'fivewin.ch'

include 'xbrowse.ch'

function Main()

local oDlg, oBrw, oFont

USE customer ALIAS CUST

DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
FONT oFont TITLE 'XBrowse Gradient Rows'

@ 10, 10 XBROWSE oBrw OF oDlg ;
SIZE 300, 200 PIXEL ;
AUTOCOLS ALIAS 'CUST' BACKGROUND ""

oBrw:nRowDividerStyle = LINESTYLE_NOLINES
oBrw:nColDividerStyle = LINESTYLE_NOLINES
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW

AEval( oBrw:aCols, { | oCol | oCol:bPaintText := { | oCol, hDC, cData, aRect | ;
PaintCol( oCol, hDC, cData, aRect ) } } )

oBrw:CreateFromCode()

ACTIVATE DIALOG oDlg CENTERED

oFont:End()

return nil

STATIC FUNCTION Colores()
LOCAL aCol:={}

IF Cust->( OrdKeyNo() ) % 2 == 0
aCol:={CLR_BLACK, RGB(193,221,255) }
ELSE
aCol:={CLR_BLACK, RGB(221,245,255) }
ENDIF

RETURN (aCol)

static function PaintCol( oCol, hDC, cData, aRect )

if oCol:oBrw:VGetPos() == Cust->( OrdKeyNo() )

  GradientFill( hDC, aRect[ 1 ] - 2, aRect[ 2 ] - 3, aRect[ 3 ] + 1, aRect[ 4 ] + 5,;
                { { 1, RGB( 220, 235, 252 ), RGB( 193, 219, 252 ) } }, .T. )


  RoundBox( hDC, 2, aRect[ 1 ] - 1, WndWidth( oCol:oBrw:hWnd ) - 22, aRect[ 3 ] + 1, 2, 2,;
            RGB( 235, 244, 253 ), 1 )
  RoundBox( hDC, 1, aRect[ 1 ] - 2, WndWidth( oCol:oBrw:hWnd ) - 21, aRect[ 3 ] + 2, 2, 2,;
            RGB( 125, 162, 206 ), 1 )

endif

SetTextColor( hDC, 0 )
DrawTextEx( hDC, cData, aRect, oCol:nDataStyle )

return nil

FWH .. BC582.. xharbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TO ANTONIO Windows Seven Xbrowse Colores
Posted: Thu Apr 08, 2010 06:50 PM

Having both pajama color effect and also windows7 look as implemented in the above sample is not possible without modifying xbrowse itself.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TO ANTONIO Windows Seven Xbrowse Colores
Posted: Fri Apr 09, 2010 06:58 AM
Ok.
If you are willing to modify xbrowse.prg, here is a way:
In xbrowse.prg:
Insert this new DATA
Code (fw): Select all Collapse
DATA lRedrawFull AS LOGICAL INIT .f.


Locate this inline method:
Code (fw): Select all Collapse
   METHOD FullPaint() INLINE ( ::lTransparent .or. ::lMergeVert )

and modify as:
Code (fw): Select all Collapse
   METHOD FullPaint() INLINE ( ::lTransparent .or. ::lMergeVert .or. ::lRedrawFull )


Now this is the modified xbrwin7.prg
Code (fw): Select all Collapse
// Using Windows 7 row selection colors in xbrowse

#include 'fivewin.ch'
#include 'xbrowse.ch'

function Main()

   local oDlg, oBrw, oFont

   USE CUSTOMER ALIAS CUST

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse Gradient Rows'

   @ 10, 10 XBROWSE oBrw OF oDlg ;
      SIZE 300, 200 PIXEL ;
      AUTOCOLS ALIAS 'CUST' //BACKGROUND ""// comment this out

   oBrw:lRedrawFull      = .t.  // insert this new line
   oBrw:nRowDividerStyle = LINESTYLE_NOLINES
   oBrw:nColDividerStyle = LINESTYLE_NOLINES
   oBrw:nMarqueeStyle    = MARQSTYLE_HIGHLROW

   AEval( oBrw:aCols, { | oCol | oCol:bPaintText := { | oCol, hDC, cData, aRect, aColors, lHighLite | ;
          PaintCol( oCol, hDC, cData, aRect, aColors, lHighLite ) } } )

   // for pajama color effect
   oBrw:bClrStd   := { || { CLR_BLACK, If( oBrw:KeyNo % 2 == 0, RGB(193,221,255), RGB(221,245,255) ) } }

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

   oFont:End()

return nil

static function PaintCol( oCol, hDC, cData, aRect, aColors, lHighLite )

   if lHighLite //oCol:VGetPos() == Cust->( OrdKeyNo() )
      GradientFill( hDC, aRect[ 1 ] - 2, aRect[ 2 ] - 3, aRect[ 3 ] + 1, aRect[ 4 ] + 5,;
                    { { 1, RGB( 220, 235, 252 ), RGB( 193, 219, 252 ) } }, .T. )
      RoundBox( hDC, 2, aRect[ 1 ] - 1, WndWidth( oCol:oBrw:hWnd ) - 22, aRect[ 3 ] + 1, 2, 2,;
                RGB( 235, 244, 253 ), 1 )
      RoundBox( hDC, 1, aRect[ 1 ] - 2, WndWidth( oCol:oBrw:hWnd ) - 21, aRect[ 3 ] + 2, 2, 2,;
                RGB( 125, 162, 206 ), 1 )
   endif

   SetTextColor( hDC, 0 )
   DrawTextEx( hDC, cData, aRect, oCol:nDataStyle )

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: TO ANTONIO Windows Seven Xbrowse Colores
Posted: Fri Apr 09, 2010 10:02 AM

it make error because not found lHighLite

FWH .. BC582.. xharbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TO ANTONIO Windows Seven Xbrowse Colores
Posted: Fri Apr 09, 2010 10:38 AM
MdaSolution wrote:it make error because not found lHighLite

Then you must be using a very old version of FWH.
In that case please use the older way like this:
Code (fw): Select all Collapse
// Using Windows 7 row selection colors in xbrowse

#include 'fivewin.ch'
#include 'xbrowse.ch'

function Main()

   local oDlg, oBrw, oFont

   USE CUSTOMER ALIAS CUST

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse Gradient Rows'

   @ 10, 10 XBROWSE oBrw OF oDlg ;
      SIZE 300, 200 PIXEL ;
      AUTOCOLS ALIAS 'CUST' //BACKGROUND ""// comment this out

   oBrw:lRedrawFull      = .t.  // insert this new line
   oBrw:nRowDividerStyle = LINESTYLE_NOLINES
   oBrw:nColDividerStyle = LINESTYLE_NOLINES
   oBrw:nMarqueeStyle    = MARQSTYLE_HIGHLROW

   AEval( oBrw:aCols, { | oCol | oCol:bPaintText := { | oCol, hDC, cData, aRect | ;
          PaintCol( oCol, hDC, cData, aRect ) } } )

   // for pajama color effect
   oBrw:bClrStd   := { || { CLR_BLACK, If( oBrw:KeyNo % 2 == 0, RGB(193,221,255), RGB(221,245,255) ) } }

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

   oFont:End()

return nil

static function PaintCol( oCol, hDC, cData, aRect )

   if oCol:oBrw:VGetPos() == Cust->( OrdKeyNo() )
      GradientFill( hDC, aRect[ 1 ] - 2, aRect[ 2 ] - 3, aRect[ 3 ] + 1, aRect[ 4 ] + 5,;
                    { { 1, RGB( 220, 235, 252 ), RGB( 193, 219, 252 ) } }, .T. )
      RoundBox( hDC, 2, aRect[ 1 ] - 1, WndWidth( oCol:oBrw:hWnd ) - 22, aRect[ 3 ] + 1, 2, 2,;
                RGB( 235, 244, 253 ), 1 )
      RoundBox( hDC, 1, aRect[ 1 ] - 2, WndWidth( oCol:oBrw:hWnd ) - 21, aRect[ 3 ] + 2, 2, 2,;
                RGB( 125, 162, 206 ), 1 )
   endif

   SetTextColor( hDC, 0 )
   DrawTextEx( hDC, cData, aRect, oCol:nDataStyle )

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: TO ANTONIO Windows Seven Xbrowse Colores
Posted: Mon Apr 12, 2010 07:43 AM

thanks now run ok

and If I want use an array

@ 50,5 XBROWSE oBrw1 ;
ARRAY aData ;
SIZE 200,70 PIXEL OF oFld1:aDialogs[1]

How I can change this line of Paintcol function ?

if oCol:oBrw:VGetPos() == Cust->( OrdKeyNo() )

FWH .. BC582.. xharbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TO ANTONIO Windows Seven Xbrowse Colores
Posted: Mon Apr 12, 2010 09:44 AM
Code (fw): Select all Collapse
if oCol:oBrw:VGetPos() == oBrw:KeyNo()

works for DBF, Array, RecSet or any other data source
Regards



G. N. Rao.

Hyderabad, India
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: TO ANTONIO Windows Seven Xbrowse Colores
Posted: Tue Apr 13, 2010 10:13 AM

gracias amigo...
todo funciona
sólo hay un problema cuando abro el cuadro de diálogo para la introducción de registros
Record de la barra se vuelve gris

FWH .. BC582.. xharbour

Continue the discussion