Page 1 of 1

First tests with new GRADIENTS ( return-values in VTOOLS )

Posted: Fri Aug 01, 2008 9:39 pm
by ukoenig
Hello,

For my new prog-releases i want to add the new
GRADIENT.

My first tests.
It is really great, i tested Gradients everywhere.
Very easy to use.

just a sample :

Gradient with same colors, but different directions
for window, dialog, office-bar, xBrowse

Image

Code: Select all


DEFINE WINDOW oWnd TITLE "DBF-Structure-Tools" 

DEFINE BUTTONBAR oBar OF oWnd SIZE 60, 60 2007 RIGHT

// -------------- Gradient Office-Bar --------------------

oBar:bClrGrad = { | lInvert | If( ! lInvert,;
   { { 0.50,16054371, 8388608 },;
      { 0.50, 8388608, 16054371 } },;
   { { 0.50, 8388608, 16054371 },;
      { 0.50, 16054371, 8388608 } } ) }

oBar:nClrText = nRGB( 255, 255, 255 )

DEFINE BUTTON OF oBar ACTION Tools(oWnd) ;
RESOURCE "attach" PROMPT "Attach" TOOLTIP "Attach"

....
....

SET MESSAGE OF oWnd TO "Testing the ButtonBar 2007 Office look" ;
CENTERED CLOCK KEYBOARD 2007

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT gradpaint1( hDC, oWnd ) ;
VALID MsgYesNo( "Do you want to end?" )

RETURN NIL

//----------------------------------------------------------------------------//

FUNCTION Tools(oWnd)

local oDlg, oLbx1, oBrush
   
DEFINE DIALOG oDlg RESOURCE "Tools" OF oWnd TITLE  "DBF-Structure"

USE CUSTOMER

oLbx1 := TXBrowse():New( oDlg )
aStruc := DBStruct()
Aeval( aStruc, {|v| v[1] := Padr( v[1], 10 ) } )
oLbx1:SetArray( aStruc)
oLbx1:nColDividerStyle := LINESTYLE_BLACK
oLbx1:nRowDividerStyle := LINESTYLE_BLACK
oLbx1:bClrSelFocus  := { ||{ CLR_WHITE, CLR_BLUE }}
oLbx1:bClrHeader  := { ||{ CLR_WHITE, CLR_BLUE }}

// -------------- Gradient xBrowse ----------------

oLbx1:bClrGrad = { | lInvert | If( ! lInvert,;
   { { 0.50,16054371, 8388608 },;
      { 0.50, 8388608, 16054371 } },;
   { { 0.50, 8388608, 16054371 },;
      { 0.50, 16054371, 8388608 } } ) }

oLbx1:aCols[1]:cHeader      := Padr("NAME", 15)
oLbx1:aCols[1]:cEditPicture := "@K !!!!!!!!!!"
oLbx1:aCols[1]:bClrEdit     := oLbx1:bClrStd
oLbx1:aCols[1]:bOnPostEdit  := {|o,x| aStruc[ oLbx1:nArrayAt, 1 ] := x }
oLbx1:aCols[1]:nEditType    := EDIT_GET
oLbx1:aCols[1]:nWidth := 80
oLbx1:aCols[1]:bEditValid   := { | oGet, oCol | VALID_1( oGet, oCol ) }

....
....

ACTIVATE DIALOG oDlg CENTERED ;
ON PAINT gradpaint2( hDC, oDlg ) 

RETURN NIL   

// With the VTOOLS you don't need ==>>  nRGB( 137, 155, 179 ) !!!!!
// just use the return-values, when you choose a color.

// For the moment, you can use the 1. release of the VTOOLS,
// to get the values of nice looking GRADIENTs.


// ----------  Gradient Windows -------------------------------------

static func gradpaint1( hDC, oWnd )

local aGrad := { { 0.50, 8388608, 16054371 } }

GradientFill( hDC,  0, 0, oWnd:nHeight, oWnd:nWidth, aGrad, .F. )

RETURN NIL

// ------------ Gradient Dialog -----------------------------------

static func gradpaint2( hDC, oDlg )

local aGrad1 := { { 0.50, 16054371, 8388608 } }

GradientFill( hDC,  0, 0, oDlg:nHeight, oDlg:nWidth, aGrad1, .F. )

RETURN NIL

Antonio, thank you very much.
It will be very useful for the new VTOOLS-update.

Best Regards
Uwe