FWH 8.12 Button on ToolBar executed twice

FWH 8.12 Button on ToolBar executed twice

Postby betoncu » Sat Jan 03, 2009 12:49 pm

Try this, when you click on button test, it is executed twice
Code: Select all  Expand view
#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
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: FWH 8.12 Button on ToolBar executed twice

Postby Antonio Linares » Sat Jan 03, 2009 5:17 pm

Birol,

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

You can solve it with this workaround:
Code: Select all  Expand view
   @ 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FWH 8.12 Button on ToolBar executed twice

Postby betoncu » Sat Jan 03, 2009 5:44 pm

It works, thanks for your help.

Birol
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 91 guests