Hello,
there was a missing ) in the source-code-result
The problem is solved.
Copy and past works fine now.
The version-no. changed to 8b
oBar:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 0.50,65535,32768 },;
{ 0.50,32768,65535 } },;
{ { 0.50,16777215,32768 },;
{ 0.50,32768,16777215 } } ) } <====
oBar:nClrText := 16777215
A new field for the Bar-object is added.
It is possible now, to define oBar, oBar1, obar2 ....
inside the tool.
Download :
http://www.pflegeplus.com/fw_downloads/Bargradient3.zip
here is a complete working sample.
It is the basic-structure of the bar-tools.
- Code: Select all Expand view RUN
#include "FiveWin.ch"
#include "xBrowse.ch"
#include "Slider.ch"
static oWnd
FUNCTION Main()
local oBar, oBtn1
SetBalloon( .T. ) // Balloon shape required for tooltips
oProgFont := TFont():New("Arial", ,-14,.F.,.F. , , , ,.F. )
DEFINE WINDOW oWnd TITLE "Gradient-Selection for" MDI MENU TMenu():New()
DEFINE BUTTONBAR oBar OF oWnd SIZE 80, 80 2007 RIGHT
// Copy and Past from the tools
// --------------------------------------
oBar:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 0.50,8388608,16777215 },;
{ 0.50,16777215,8388608 } },;
{ { 0.50,128,16777215 },;
{ 0.50,16777215,128 } } ) }
oBar:nClrText := 16777215
DEFINE BUTTON oBtn1 OF oBar ACTION ( Tools(oWnd,oBar,oBtn1) ) ;
RESOURCE "magic" PROMPT "Bar-Selection" TOOLTIP "Bar-Select"
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
//----------------- DIALOG ( MDI ) ------------------------------------//
FUNCTION Tools(oWnd,oBar)
LOCAL oDlg, oBar1, oBtn10
DEFINE DIALOG oDlg RESOURCE "Tools" OF oWnd TITLE "Gradient-Color-Selection" FONT oProgFont
// ----------- Your fields
// You have to call the BUTTONBAR at INIT
REDEFINE BUTTONBMP oBtn10 ID 10 OF oDlg ;
ACTION ( oDlg:End() ) ;
BITMAP "Quit" PROMPT " Exit" TEXTRIGHT
oBtn10:cToolTip = { "Close" + CRLF + ;
"the Dialog","Gradient-Test", 1, CLR_BLACK, 14089979 }
ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
ON PAINT gradpaint2( hDC, oDlg ) ;
ON INIT NEW_DLGBAR(oDlg)
RETURN NIL
// -----------------------------------------------
static func gradpaint1( hDC, oWnd )
local aGrad := { { 0.50, 8388608, 16054371 } }
GradientFill( hDC, 0, 0, oWnd:nHeight, oWnd:nWidth, aGrad, .F. )
RETURN NIL
// -----------------------------------------------
static func gradpaint2( hDC, oDlg )
local aGrad1 := { { 0.50, 16054371, 8388608 } }
GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aGrad1, .F. )
RETURN NIL
// ------- TEST - BAR --------------------------
FUNCTION NEW_DLGBAR(oDlg)
LOCAL oBar1
DEFINE BUTTONBAR oBar1 OF oDlg SIZE 80, 80 2007 RIGHT
// Copy and Past from the tools
// --------------------------------------
oBar1:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 0.50,128,16777215 },;
{ 0.50,16777215,128 } },;
{ { 0.50,128,16777215 },;
{ 0.50,16777215,128 } } ) }
oBar1:nClrText := 16777215
DEFINE BUTTON OF oBar1 ACTION MsgInfo( "Attach" ) ;
RESOURCE "attach" PROMPT "Attach" TOOLTIP "Attach"
DEFINE BUTTON OF oBar1 ACTION MsgInfo( "calendar" ) ;
RESOURCE "calendar" PROMPT "Calendar" TOOLTIP "Calendar"
DEFINE BUTTON OF oBar1 ACTION MsgInfo( "Clients" ) ;
RESOURCE "people" PROMPT "Clients" TOOLTIP "Clients"
DEFINE BUTTON OF oBar1 ACTION oDlg:End() ;
RESOURCE "quit" PROMPT "Exit" TOOLTIP "Exit"
RETURN( NIL )
// ------------- The RC-File ------------
#ifdef __FLAT__
1 24 "WindowsXP.Manifest"
#endif
#define DIALOG_2 2
#define DIALOG_1 1
attach BITMAP "attach.bmp"
calendar BITMAP "calendar.bmp"
people BITMAP "people.bmp"
print BITMAP "print.bmp"
magic BITMAP "magic.bmp"
exit BITMAP "exit.bmp"
floppy BITMAP "floppy.bmp"
open BITMAP "open.bmp"
quit BITMAP "quit.bmp"
help BITMAP "help.bmp"
info BITMAP "info.bmp"
colors BITMAP "colors.bmp"
fonts BITMAP "fonts.bmp"
info1 BITMAP "info1.bmp"
Tools DIALOG 4, 53, 409, 303
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "DBF-Structure"
FONT 10, "MS Sans Serif"
{
DEFPUSHBUTTON "Exit", 10, 282, 271, 68, 27
}
The complete working-directory with EXE-file :
http://www.pflegeplus.com/fw_downloads/TestBar.zip
Best regards
Uwe