Hello Codemaker,
A Sample to show the Logic changing BMP's and using the same Button with different Actions:1. define a Array for the used BMP's
2. use => ACTION
oButt3:SetFile( aBtn[4][1], aBtn[4][2] ) ;
That will replace on Button-action 2 the Button 3 ( TRASH.BMP )
with the defined BMP's in Arrayelement 4 ( PENDRIVE.BMP )
To use different Actions with on Button,
You need another Array => .T. or .F. for each Button.
With the BMP-change change the Status as well.
It means : .T. = Action 1, .F. = Action 2
In this sample, Button 3 shows on Action the Message : Action 1 ( aAct[3] := .T. ).
After the BMP-change the Action shows the Message : Action 2 ( aAct[3] := .F. defined in Button 2-action ).
Maybe You want to show a
BMP disabled as well ?
The Array can be : aBtn[5][4] => BTN_UP, BTN_DOWN,
BTN_DISABLE, BTN_OVERMOUSE
FUNCTION changed in FWH 12.01 !!! ( Drive is included )
c_path :=
GETCURDIR() + "\"
maybe You have to use :
c_path := CURDRIVE() + ":\" + GETCURDIR() + "\"
![Image](http://www.pflegeplus.com/pictures/btnchg.jpg)
Code: Select all | Expand
#include "FiveWin.ch"
static oWnd, oBar, oBrush, cFile, oButtFont, oCursorHand
FUNCTION Main()
LOCAL hDCo, oButt1, oButt2, oButt3, oButt4, oButt5, oButt6
LOCAL aBtn[5][2], aAct[5]
c_path := GETCURDIR() + "\"
// can be : aBtn[5][4] => BTN_UP, BTN_DOWN, BTN_DISABLE, BTN_OVERMOUSE
aBtn[1][1] := c_path + "\project\ICHAT.BMP"
aBtn[1][2] := c_path + "\project\ICHAT.BMP"
aAct[1] := .T.
aBtn[2][1] := c_path + "\project\EXPLORER.BMP"
aBtn[2][2] := c_path + "\project\EXPLORER.BMP"
aAct[2] := .T.
aBtn[3][1] := c_path + "\project\TRASH.BMP"
aBtn[3][2] := c_path + "\project\TRASH.BMP"
aAct[3] := .T.
aBtn[4][1] := c_path + "\project\PENDRIVE.BMP"
aBtn[4][2] := c_path + "\project\PENDRIVE.BMP"
aAct[4] := .T.
aBtn[5][1] := c_path + "\project\PALM.BMP"
aBtn[5][2] := c_path + "\project\PALM.BMP"
aAct[5] := .T.
oDlgFont := TFont():New("Arial", ,-14,.F.,.F.,,,,.F.)
oButtFont := TFont():New("Arial",,-14,.F.,.F.,,,,.F.)
DEFINE CURSOR oCursorHand HAND
SetBalloon( .T. )
// Style
// -------
DEFINE BRUSH oBrush STYLE "BRICKS"
DEFINE WINDOW oWnd TITLE "Testing Source of Bar-Tools" ;
MENU TMenu():New() BRUSH oBrush
DEFINE BUTTONBAR oBar OF oWnd SIZE 100,80 3DLOOK 2007 LEFT
oBar:oFont := oButtFont
oBar:SetColor( 0)
oBar:bClrGrad = { | lInvert | If( ! lInvert, ;
{ { 0.80,14853684,16314573 }, ;
{ 0.80,16314573,14853684 } }, ;
{ { 0.80,14853684,14853684 }, ;
{ 0.80,14853684,14853684 } } ) }
DEFINE BUTTON oButt1 OF oBar FILE aBtn[1][1], aBtn[1][2] ;
MESSAGE "Button 1" ;
ACTION MsgAlert( "Button 1","Attention" ) ;
PROMPT "Button 1"
oButt1:cToolTip := { " " + CRLF + "Button 1", "1. Button", 1, 0, 128 }
DEFINE BUTTON oButt2 OF oBar FILE aBtn[2][1], aBtn[2][2] ;
MESSAGE "Button 2" ;
ACTION ( oButt3:SetFile( aBtn[4][1], aBtn[4][2] ), aAct[3] := .F. ) ;
PROMPT "Button 2"
oButt2:cToolTip := { " " + CRLF + "Button 2", "2. Button", 1, 0, 128 }
DEFINE BUTTON oButt3 OF oBar FILE aBtn[3][1], aBtn[3][2] ;
MESSAGE "Button 3" ;
ACTION ( oButt2:Enable(), ;
IIF( aAct[3] = .T., MsgAlert( "Action 1" ), MsgAlert( "Action 2" ) ) ) ;
PROMPT "Button 3"
oButt3:cToolTip := { " " + CRLF + "Button 3", "3. Button", 1, 0, 128 }
DEFINE BUTTON oButt4 OF oBar FILE aBtn[4][1], aBtn[4][2] ;
MESSAGE "Button 4" ;
ACTION oButt2:Disable() ;
PROMPT "Button 4"
oButt4:cToolTip := { " " + CRLF + "Button 4", "4. Button", 1, 0, 128 }
DEFINE BUTTON oButt5 OF oBar FILE aBtn[5][1], aBtn[5][2] ;
MESSAGE "Button 5" ;
ACTION MsgAlert( "Button 5","Attention" ) ;
PROMPT "Button 5"
oButt5:cToolTip := { " " + CRLF + "Button 5", "5. Button", 1, 0, 128 }
DEFINE BUTTON oButt6 OF oBar FILE c_path + "\project\Stop.bmp" MESSAGE "Close" ;
ACTION ( oWnd:End() ) ;
PROMPT "Close"
oButt6:cToolTip := { " " + CRLF + "Close BarTools", "Close", 1, 0, 128 }
AEval( oWnd:aControls, { | o | o:oCursor := oCursorHand } )
SET MESSAGE OF oWnd TO "Bar-Test" ;
CENTERED CLOCK KEYBOARD 2007
ACTIVATE WINDOW oWnd MAXIMIZED ;
RETURN NIL
It seems, FWH is getting more and more popular.
I noticed sometimes more than 20 Guests online.Best Regards
Uwe
![Laughing :lol:](./images/smilies/icon_lol.gif)