TO ANTONIO Windows Seven Xbrowse Colores

TO ANTONIO Windows Seven Xbrowse Colores

Postby MdaSolution » Fri Apr 02, 2010 6: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)
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

Postby MdaSolution » Thu Apr 08, 2010 8:17 am

Antonio please any solution ?
FWH .. BC582.. xharbour
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: TO ANTONIO Windows Seven Xbrowse Colores

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TO ANTONIO Windows Seven Xbrowse Colores

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

Re: TO ANTONIO Windows Seven Xbrowse Colores

Postby nageswaragunupudi » Thu Apr 08, 2010 6: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
User avatar
nageswaragunupudi
 
Posts: 10627
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TO ANTONIO Windows Seven Xbrowse Colores

Postby nageswaragunupudi » Fri Apr 09, 2010 6:58 am

Ok.
If you are willing to modify xbrowse.prg, here is a way:
In xbrowse.prg:
Insert this new DATA
Code: Select all  Expand view
DATA lRedrawFull AS LOGICAL INIT .f.


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

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


Now this is the modified xbrwin7.prg
Code: Select all  Expand view
// 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
nageswaragunupudi
 
Posts: 10627
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TO ANTONIO Windows Seven Xbrowse Colores

Postby MdaSolution » Fri Apr 09, 2010 10:02 am

it make error because not found lHighLite
FWH .. BC582.. xharbour
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: TO ANTONIO Windows Seven Xbrowse Colores

Postby nageswaragunupudi » 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: Select all  Expand view
// 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
nageswaragunupudi
 
Posts: 10627
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TO ANTONIO Windows Seven Xbrowse Colores

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

Re: TO ANTONIO Windows Seven Xbrowse Colores

Postby nageswaragunupudi » Mon Apr 12, 2010 9:44 am

Code: Select all  Expand view
if oCol:oBrw:VGetPos() == oBrw:KeyNo()

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10627
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TO ANTONIO Windows Seven Xbrowse Colores

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: jmartial, Marc Venken and 114 guests