Bartools2 tooltip balloon is wrong color ( ukoenig )

Post Reply
User avatar
Rick Lipkin
Posts: 2668
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Bartools2 tooltip balloon is wrong color ( ukoenig )

Post by Rick Lipkin »

Ukoenig

I am cutting and pasting your bartools code and the tool top color is not black on white but black on red .. here is the code :

Code: Select all | Expand


oButtFont := TFont():New("Arial",,-14,.F.,.F.,,,,.F.)
DEFINE CURSOR oCursorHand HAND
SetBalloon( .T. )

..
..

DEFINE ICON oICO RESOURCE "KEY1"
// Color
// -------
DEFINE BRUSH oBrush  COLOR 5197647

DEFINE WINDOW oWind TITLE "VEHICLE and FLEET Maintenance Program"   ;
MENU TMenu():New() BRUSH oBrush ;
ICON oICO ;
MDI

DEFINE BUTTONBAR oBar OF oWind SIZE 100,80 3DLOOK 2007 RIGHT

oBar:oFont := oButtFont
oBar:SetColor( 0)

oBar:bClrGrad = { | lInvert | If( ! lInvert, ;
   { { 0.50,5197647,15724527 }, ;
     { 0.50,15724527,5197647 } }, ;
   { { 0.50,5197647,5197647 }, ;
     { 0.50,5197647,5197647 } } ) }


DEFINE BUTTON oButt1 OF oBar FILE c_path + "\project\FORMAT.BMP" ;
MESSAGE "Button 1" ;
ACTION _vehbrow( oWIND,obar ) ;
PROMPT "Button 1"

oButt1:cToolTip := { " " + CRLF + "Button 1", "1. Button", 1, 0, 128 }

DEFINE BITMAP oBMAP FILENAME (cOLDDEFA+"\VEHICLE.BMP") of oWind

SET MESSAGE OF oWind                                          ;
   to xMESSAGE CLOCK KEYBOARD 2007

ACTIVATE WINDOW oWind                                         ;
   MAXIMIZED ;
   ON PAINT ( IF( xTEXT = "/NL", ,PalBmpDraw( hDC, 0,0, oBMAP:hBitmap, oBMAP:hPalette, nSCR1, nSCR2 )));
   ON INIT ( IF( xTEXT = "/NL", , MSGLOGO( cDEFA+"\SPLASH.BMP",2 )),               ;
             oWIND:Select(),  oWIND:Refresh() )               ;
   VALID ( IIF( !lExitPgm, ExitPgm( .T. ) , .F. ))

RETURN( NIL )

 


The screen looks correct :

Image

But the tooltip color is not correct ...

Image

I had to cut out this line of code because it errored with the MDI clause :

Code: Select all | Expand


AEval( oWind:aControls, { | o | o:oCursor := oCursorHand } )
 


Code: Select all | Expand


Application
===========
   Path and name: C:\FOX\DHEC\VEHSQL-NEW\Veh32.Exe (32 bits)
   Size: 3,509,248 bytes
   Time from start: 0 hours 0 mins 0 secs
   Error occurred at: 07/04/2010, 19:55:06
   Error description: Error BASE/2017  Argument error: AEVAL
   Args:
     [   1] = U  
     [   2] = B   {|| ... }
     [   3] = U  
     [   4] = U  
 



Any ideas on how to get the tool top balloon to be black on white ?

Thanks
Rick Lipkin
User avatar
ukoenig
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Bartools2 tooltip balloon is wrong color ( ukoenig )

Post by ukoenig »

Hello Rick,

the Background-structure for MDI- and CHILD-Windows :
( ON INIT for Background, works only with CHILD-Window or Dialog )
GRADIENT works with ON PAINT.

Image

Code: Select all | Expand


#include "FiveWin.ch"
#include "Image.ch"
#include "dtpicker.ch"

STATIC oWndMain, hDC, oIco, oBrush, oBar, xTEXT
STATIC oBarFont, oButtFont, oSayFont, oDlgFont, oSelFont

FUNCTION MAIN()
LOCAL oButt1, oButt2
LOCAL oButtFont := TFont():New( "Arial",27,-47,.F.,.T.,0,0,0,.T.)
LOCAL nSCR1 := GetSysMetrics(0) // Horizontal
LOCAL nSCR2 := GetSysMetrics(1) // Height

SET _3DLOOK ON
SetBalloon( .T. )
c_path := CURDRIVE() + ":\" + GETCURDIR()

// --------- YOUR SELECTION !!!! --------------
xTEXT = "
/NB"  // BMP-Brush Background selected
// --------------------------------------------------

DEFINE ICON oIco FILENAME c_path + "
\Project\Super.ico"

IF xTEXT = "
  " .or. xTEXT = "/NG" // Normal or GRADIENT
    // Full Screen
    DEFINE WINDOW oWndMain FROM 0, 0 TO nSCR1, nSCR2  PIXEL ICON oIco ;
    TITLE "
Normal Window" ;
    MENU TMenu():New() ;
    MDI    
ENDIF
IF xTEXT = "
/NC" // Color
    DEFINE BRUSH oBrush  COLOR 5197647

    DEFINE WINDOW oWndMain FROM 0, 0 TO nSCR1, nSCR2  PIXEL ICON oIco ;
    TITLE "
VEHICLE and FLEET Maintenance Program" ;
    MENU TMenu():New() ;
    BRUSH oBrush ;
    MDI

    oBrush:End()
ENDIF
IF xTEXT = "
/NI" // Image
    DEFINE BRUSH oBrush FILENAME  c_path + "
\Project\FANTASY.JPG"

    DEFINE WINDOW oWndMain FROM 0, 0 TO nSCR1, nSCR2  PIXEL ICON oIco ;
    TITLE "
VEHICLE and FLEET Maintenance Program" ;
    MENU TMenu():New() ;
    BRUSH oBrush ;
    MDI

    oBrush:End()
ENDIF
IF xTEXT = "
/NB" // Image-Brush
    DEFINE BRUSH oBrush FILENAME  c_path + "
\Project\PAPER.Bmp"

    DEFINE WINDOW oWndMain FROM 0, 0 TO nSCR1, nSCR2  PIXEL ICON oIco ;
    TITLE "
VEHICLE and FLEET Maintenance Program" ;
    MENU TMenu():New() ;
    BRUSH oBrush ;
    MDI

    oBrush:End()
ENDIF

// ---- Buttonbar ------------------

DEFINE BUTTONBAR oBar OF oWndMain SIZE 100,80 3DLOOK 2007 RIGHT

oBar:oFont := oButtFont
oBar:SetColor( 0)

oBar:bClrGrad = { | lInvert | If( ! lInvert, ;
   { { 0.50,5197647,15724527 }, ;
     { 0.50,15724527,5197647 } }, ;
   { { 0.50,5197647,5197647 }, ;
     { 0.50,5197647,5197647 } } ) }

 AEval( oBar:aControls, { | o | o:oCursor := oCursorHand } )

DEFINE BUTTON oButt1 OF oBar FILE c_path + "
\project\EXPLORER.BMP" ;
MESSAGE "
Button 1" ;
ACTION  MsgAlert( "
Test" ) ; //  _vehbrow( oWIND,obar ) ;
PROMPT "
Button 1"
oButt1:cToolTip := { "
" + CRLF + "Button 1", "1. Button", 1, 0, 128 }

DEFINE BUTTON oButt2 OF oBar FILE c_path + "
\project\EXPLORER.BMP" ;
MESSAGE "
Child" ;
ACTION  ( xTEXT := "
/NI", CHILD() ) ;   // Image on CHILD-Window
PROMPT "
Child"
oButt2:cToolTip := { "
" + CRLF + "MDI Child", "MDI Child", 1, 0, 128 }

DEFINE BUTTON oButt3 OF oBar FILE c_path + "
\project\EXPLORER.BMP" ;
MESSAGE "
Exit" ;
ACTION  oWndMain:End() ;
PROMPT "
Exit"
oButt3:cToolTip := { "
" + CRLF + "Exit MDI", "Exit", 1, 0, 128 }

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


// SET MESSAGE OF oWndMain  ;
// to xMESSAGE CLOCK KEYBOARD 2007

// Gradient - Paint in ON PAINT ( if needed ) works with CHILD as well

ACTIVATE WINDOW oWndMain ;
MAXIMIZED ;
ON PAINT (  IIF( xTEXT = "
/NG", W_GRAD( oWndMain, hDC, .T., 0.5, 16777215, 4177582 ), NIL ), ;
                   IIF( xTEXT = "
/NI", MSGLOGO( c_path + "\project\VIDEO.BMP",2 ), NIL ) )

RETURN( NIL )

//--------------- Child - Background works ON INIT ---------------------------//

FUNCTION CHILD()
LOCAL oWndChild, oBtn, oBar

DEFINE  WINDOW oWndChild MDICHILD OF oWndMain ;
COLOR "
N/W"

DEFINE  BUTTONBAR oBar OF oWndChild SIZE 24,26 3D

DEFINE  BUTTON oBtn OF oBar TOOLTIP "
Salir";
MESSAGE "
Ventana de MDI" ACTION oWndChild:End()

// oWndChild:bKeyDown := {|nkey,nFlag| IIF(nKey == 27, oWndChild:End(), .T.)}

ACTIVATE WINDOW oWndChild ;
ON INIT CHILD_BGRD(oWndChild) ;
valiD(msgyesno("
¨Salimos?"))

RETURN NIL

// --------- GRADIENT  ----------------------

FUNCTION W_GRAD( oWnd, hDC, lDirect, nMove, nColor1, nColor2 )
local aGrad := { { nMove, nCOLOR1, nCOLOR2 }, ;
                          { nMove, nCOLOR2, nCOLOR1 } }        

GradientFill( hDC,  0, 0, oWnd:nHeight, oWnd:nWidth, aGrad, lDirect )

RETURN NIL

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

FUNCTION CHILD_BGRD(oWnd)
LOCAL oBrush

IF xTEXT = "
/NC" // Color
    DEFINE BRUSH oBrush  COLOR 5197647
    oWnd:Setbrush( oBrush )
ENDIF
IF xTEXT = "
/NI" // Image-Size for Background to be calculated / resized to window-size
     DEFINE IMAGE oTmp FILENAME c_path +  "
\Project\FANTASY.JPG"
     oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, oWnd:nWidth, oWnd:nHeight, .T. ) )
     oWnd:Setbrush( oBrush )
 ENDIF
IF xTEXT = "
/NB" // Image-Brush
    DEFINE BRUSH oBrush FILENAME  c_path + "
\Project\PAPER.Bmp"
    oWnd:Setbrush( oBrush )
ENDIF
oBrush:End()

RETURN( NIL )


BetRga
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Rick Lipkin
Posts: 2668
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Bartools2 tooltip balloon is wrong color ( ukoenig )

Post by Rick Lipkin »

Uwe

Thanks for the quick responce .. this code you inserted fixed the control error ..

Code: Select all | Expand


AEval( oBar:aControls, { | o | o:oCursor := oCursorHand } )
 


As far as the off color balloon .. I can not seem to be able to reduce it down to a reproducable set of code .. everything I do to reproduce it in a seperate small sample works fine .. however the production code is much larger and for some reason the color of the balloon help is that aughful red background color ..

In any event .. I am grateful for your help .. I am using 1.2 June 2009 version of your buttonbar tool .. is there a newer version ??

Your tools are a great help !!

Rick Lipkin
User avatar
ukoenig
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Bartools2 tooltip balloon is wrong color ( ukoenig )

Post by ukoenig »

Hello Rick,

as far as I can remember, i created a < all in one Solution > together wih Buttonskins :
posting.php?mode=edit&f=3&p=94238
viewtopic.php?f=3&t=18148&p=95136&hilit=buttontools+4#p95136

Image

Image

Image

In some Situations ( Buttonbar with many Buttons ), I externalize the Buttonbar from the Main-Function :

#include "FiveWin.ch"
#include "Image.ch"
#include "dtpicker.ch"

STATIC oWndMain, hDC, oIco, oButtFont

FUNCTION MAIN()
LOCAL oBrush

LOCAL nSCR1 := GetSysMetrics(0) // Screen Width
LOCAL nSCR2 := GetSysMetrics(1) // Screen Height

oButtFont := TFont():New( "Arial",27,-47,.F.,.T.,0,0,0,.T.)

SET _3DLOOK ON
SetBalloon( .T. )
c_path := CURDRIVE() + ":\" + GETCURDIR()

DEFINE ICON oIco FILENAME c_path + "\Project\Super.ico"

// Background Brush-define for Main-Window

DEFINE WINDOW oWndMain FROM 0, 0 TO nSCR1, nSCR2 PIXEL ICON oIco ; // Brush oBrush
TITLE "Main Window" ;
MENU TMenu():New() ;
MDI
...
...
ACTIVATE WINDOW oWndMain MAXIMIZED ;
ON INIT MAKE_BAR()

oButtFont:End()
oBrush:End()

RETURN( NIL )

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

FUNCTION MAKE_BAR()
LOCAL oBar

DEFINE BUTTONBAR oBar OF oWndMain SIZE 100,80 3DLOOK 2007 RIGHT

oBar:oFont := oButtFont
oBar:SetColor( 0)

oBar:bClrGrad = { | lInvert | If( ! lInvert, ;
{ { 0.50,5197647,15724527 }, ;
{ 0.50,15724527,5197647 } }, ;
{ { 0.50,5197647,5197647 }, ;
{ 0.50,5197647,5197647 } } ) }

AEval( oBar:aControls, { | o | o:oCursor := oCursorHand } )

DEFINE BUTTON oButt1 OF oBar FILE c_path + "\project\EXPLORER.BMP" ;
MESSAGE "Button 1" ;
ACTION MsgAlert( "Test" ) ; // _vehbrow( oWIND,obar ) ;
PROMPT "Button 1"
oButt1:cToolTip := { " " + CRLF + "Button 1", "1. Button", 1, 0, 128 }

DEFINE BUTTON oButt2 OF oBar FILE c_path + "\project\EXPLORER.BMP" ;
MESSAGE "Child" ;
ACTION ( xTEXT := "/NG", CHILD() ) ; // Image on CHILD
PROMPT "Child"
oButt2:cToolTip := { " " + CRLF + "MDI Child", "MDI Child", 1, 0, 128 }

DEFINE BUTTON oButt3 OF oBar FILE c_path + "\project\EXPLORER.BMP" ;
MESSAGE "Exit" ;
ACTION oWndMain:End() ;
PROMPT "Exit"
oButt3:cToolTip := { " " + CRLF + "Exit MDI", "Exit", 1, 0, 128 }

RETURN( NIL )

Besr Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Rick Lipkin
Posts: 2668
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Bartools2 tooltip balloon is wrong color ( ukoenig )

Post by Rick Lipkin »

Uwe

Thanks for all your help and advice .. I will probably externalize the button bar on the INIT clause as you suggest with your code sample and will let you know.

I just downloaded your button skins ver 4 tool ..

Thanks
Rick
Post Reply