Page 1 of 1

TO ANTONIO Windows Seven Xbrowse Colores

Posted: Fri Apr 02, 2010 6:42 pm
by MdaSolution
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 http://forums.fivetechsupport.com/viewt ... 369#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)

Re: Windows Seven Xbrowse Colores

Posted: Thu Apr 08, 2010 8:17 am
by MdaSolution
Antonio please any solution ?

Re: TO ANTONIO Windows Seven Xbrowse Colores

Posted: Thu Apr 08, 2010 10:36 am
by Antonio Linares
Mda,

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

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

Re: TO ANTONIO Windows Seven Xbrowse Colores

Posted: Thu Apr 08, 2010 11:23 am
by MdaSolution
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

Re: TO ANTONIO Windows Seven Xbrowse Colores

Posted: Thu Apr 08, 2010 6:50 pm
by nageswaragunupudi
Having both pajama color effect and also windows7 look as implemented in the above sample is not possible without modifying xbrowse itself.

Re: TO ANTONIO Windows Seven Xbrowse Colores

Posted: Fri Apr 09, 2010 6:58 am
by nageswaragunupudi
Ok.
If you are willing to modify xbrowse.prg, here is a way:
In xbrowse.prg:
Insert this new DATA

Code: Select all

DATA lRedrawFull AS LOGICAL INIT .f.
Locate this inline method:

Code: Select all

   METHOD FullPaint() INLINE ( ::lTransparent .or. ::lMergeVert )
and modify as:

Code: Select all

   METHOD FullPaint() INLINE ( ::lTransparent .or. ::lMergeVert .or. ::lRedrawFull )
Now this is the modified xbrwin7.prg

Code: Select all

// 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: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
 

Re: TO ANTONIO Windows Seven Xbrowse Colores

Posted: Fri Apr 09, 2010 10:02 am
by MdaSolution
it make error because not found lHighLite

Re: TO ANTONIO Windows Seven Xbrowse Colores

Posted: Fri Apr 09, 2010 10:38 am
by nageswaragunupudi
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: Select all

// 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
 

Re: TO ANTONIO Windows Seven Xbrowse Colores

Posted: Mon Apr 12, 2010 7:43 am
by MdaSolution
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() )

Re: TO ANTONIO Windows Seven Xbrowse Colores

Posted: Mon Apr 12, 2010 9:44 am
by nageswaragunupudi

Code: Select all

if oCol:oBrw:VGetPos() == oBrw:KeyNo()
works for DBF, Array, RecSet or any other data source

Re: TO ANTONIO Windows Seven Xbrowse Colores

Posted: Tue Apr 13, 2010 10:13 am
by MdaSolution
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