FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWH 8.12 Button on ToolBar executed twice
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
FWH 8.12 Button on ToolBar executed twice
Posted: Sat Jan 03, 2009 12:49 PM
Try this, when you click on button test, it is executed twice
#INCLUDE "FiveWin.ch"

FUNCTION Main()
local oWnd, oReBar, oToolBar, oImageList, oExtBtn

   DEFINE WINDOW oWnd PIXEL FROM 0, 0 TO 610,664

   DEFINE STATUSBAR OF oWnd PROMPT ""

   DEFINE IMAGELIST oImageList SIZE 16, 16

   oImageList:AddMasked( TBitmap():Define( "BTN_TOP"    , , oWnd ), nRGB( 192, 192, 192 ) )
   oImageList:AddMasked( TBitmap():Define( "BTN_PRIOR"  , , oWnd ), nRGB( 192, 192, 192 ) )
   oImageList:AddMasked( TBitmap():Define( "BTN_NEXT"   , , oWnd ), nRGB( 192, 192, 192 ) )
   oImageList:AddMasked( TBitmap():Define( "BTN_LAST"   , , oWnd ), nRGB( 192, 192, 192 ) )

   oReBar = TReBar():New( oWnd )
   oToolBar = TToolBar():New( oReBar, 30, 30, oImageList )

   DEFINE TBBUTTON OF oToolBar ACTION MsgInfo(1)
   DEFINE TBBUTTON OF oToolBar ACTION MsgInfo(1)
   DEFINE TBBUTTON OF oToolBar ACTION MsgInfo(1)
   DEFINE TBBUTTON OF oToolBar ACTION MsgInfo(1)

   DEFINE TBSEPARATOR OF oToolBar

   @ 3,339 BUTTON oExtBtn PROMPT "Test" ;
           SIZE 70,24 ;
           ACTION MsgInfo('Clicked') ;
           OF oToolBar ;
           PIXEL

   oReBar:InsertBand( oToolBar )

   ACTIVATE WINDOW oWnd VALID (oImageList:End(), .T. )

RETURN NIL


Regards,
Birol Betoncu
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 8.12 Button on ToolBar executed twice
Posted: Sat Jan 03, 2009 05:17 PM
Birol,

Windows is sending a WM_COMMAND to both the mdiframe and the rebar.

You can solve it with this workaround:
   @ 3,339 BUTTON oExtBtn PROMPT "Test" ;
           SIZE 70,24 ;
           ACTION If( Left( ProcName( 6 ), 6 ) == "TREBAR", MsgInfo( "Clicked" ), nil ) ;
           OF oToolBar ;
           PIXEL
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: FWH 8.12 Button on ToolBar executed twice
Posted: Sat Jan 03, 2009 05:44 PM

It works, thanks for your help.

Birol

Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7

Continue the discussion