TO ANTONIO Windows Seven Xbrowse Colores

Post Reply
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

TO ANTONIO Windows Seven Xbrowse Colores

Post 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)
Last edited by MdaSolution on Thu Apr 08, 2010 8:18 am, edited 1 time in total.
FWH .. BC582.. xharbour
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: Windows Seven Xbrowse Colores

Post by MdaSolution »

Antonio please any solution ?
FWH .. BC582.. xharbour
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: TO ANTONIO Windows Seven Xbrowse Colores

Post by Antonio Linares »

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
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: TO ANTONIO Windows Seven Xbrowse Colores

Post 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
FWH .. BC582.. xharbour
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: TO ANTONIO Windows Seven Xbrowse Colores

Post by nageswaragunupudi »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: TO ANTONIO Windows Seven Xbrowse Colores

Post 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
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: TO ANTONIO Windows Seven Xbrowse Colores

Post by MdaSolution »

it make error because not found lHighLite
FWH .. BC582.. xharbour
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: TO ANTONIO Windows Seven Xbrowse Colores

Post 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
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: TO ANTONIO Windows Seven Xbrowse Colores

Post 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() )
FWH .. BC582.. xharbour
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: TO ANTONIO Windows Seven Xbrowse Colores

Post by nageswaragunupudi »

Code: Select all

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

G. N. Rao.
Hyderabad, India
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: TO ANTONIO Windows Seven Xbrowse Colores

Post 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
FWH .. BC582.. xharbour
Post Reply