// Win32 TReBar and TToolBar sample into DIALOGS
#include "FiveWin.ch"
function Main()
local oWnd, oReBar, oToolBar1, oToolBar2, oImageList1, oImageList2, oImageList3
DEFINE DIALOG oWnd NAME "DIALOG" TITLE "FWH - Testing Win32 ReBars & Toolbars"
ACTIVATE DIALOG oWnd ;
ON INIT CREABARRA( @oImageList1, @oImageList2, @oImageList3, oWnd )
oImageList1:End()
oImageList2:End()
oImageList3:End()
return nil
FUNCTION CREABARRA( oImageList1, oImageList2, oImageList3, oWnd )
LOCAL oReBar, oToolBar1, oToolBar2
// First we build the imagelists with all the bitmaps
oImageList1 = TImageList():New( 32, 32 ) // width and height of bitmaps
oImageList1:AddMasked( TBitmap():Define( "new",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList1:AddMasked( TBitmap():Define( "open",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList1:AddMasked( TBitmap():Define( "search",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList1:AddMasked( TBitmap():Define( "print",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList3 = TImageList():New( 16, 16 ) // width and height of bitmaps
oImageList3:AddMasked( TBitmap():Define( "new",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList3:AddMasked( TBitmap():Define( "open",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList3:AddMasked( TBitmap():Define( "search",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList3:AddMasked( TBitmap():Define( "print",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList2 = TImageList():New( 32, 32 ) // width and height of bitmaps
oImageList2:AddMasked( TBitmap():Define( "internet",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList2:AddMasked( TBitmap():Define( "keys",, oWnd ), nRGB( 255, 0, 255 ) )
oImageList2:AddMasked( TBitmap():Define( "quit",, oWnd ), nRGB( 255, 0, 255 ) )
// Now we create the rebar
oReBar = TReBar():New( oWnd )
// Now we create the toolbars and add the buttons
oToolBar1 = TToolBar():New( oReBar, 50, 50, oImageList1 )
oToolBar1:AddButton( { || MsgInfo( "New" ) }, "New", "New project" )
oToolBar1:AddButton( { || MsgInfo( "Open" ) }, "Open", "Open project" )
oToolBar1:AddSeparator()
oToolBar1:AddButton( { || MsgInfo( "Search" ) }, "Search", "Search" )
oToolBar1:AddButton( { || MsgInfo( "Print" ) }, "Print a report", "Print" )
oToolBar2 = TToolBar():New( oReBar, 50, 50, oImageList2 )
oToolBar2:AddButton( { || MsgInfo( "Upgrade" ) }, "Search for new versions",;
"Upgrade..." )
oToolBar2:AddButton( { || oToolBar1:nBtnWidth := 16, oToolBar1:nBtnHeight := 16,;
oImageList1:End(), ;
SendMessage( oToolBar1:hWnd, 1072, 0, oImageList3:hImageList ),;
oToolBar1:Refresh() }, "Users management", "Users" )
oToolBar2:AddSeparator()
oToolBar2:AddButton( { || oWnd:End() }, "End Application", "Exit" )
// We set the widths for each toolbar
oToolBar1:nWidth = 290
oToolBar2:nWidth = 300
// Now we insert the toolbars into the rebar
oReBar:InsertBand( oToolBar1 )
oReBar:InsertBand( oToolBar2 )
RETURN .T.