// Win32 TReBar and TToolBar sample
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
local oWnd, oReBar, oToolBar1, oToolBar2, oImgList1, oImgList2
local oTabs2,oPanel,oPanel2,oExtBtn
DEFINE WINDOW oWnd TITLE "FWH - Testing Win32 ReBars & Toolbars" ;
MENU BuildMenu()
@ 8, 0 TABS oTabs2;
PROMPTS "&Rezeptionslisten","&Planlisten" OF oWnd;
BITMAPS "..\bitmaps\16x16\people.bmp", "..\bitmaps\16x16\open2.bmp";
ACTION f_tab(oTabs2:nOption,oPanel,oPanel2)
oWnd:oTop = oTabs2
oPanel := TPanel():New( 18, 0, oWnd:nHeight, oWnd:nWidth, oWnd )
oPanel2 := TPanel():New( 18, 0, 1000, 2000, oWnd )
// First we build the imagelists with all the bitmaps
DEFINE IMAGELIST oImgList1 SIZE 32, 32
DEFINE IMGBITMAP OF oImgList1 NAME "new" COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImgList1 NAME "open" COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImgList1 NAME "search" COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImgList1 NAME "print" COLOR nRGB( 255, 0, 255 )
DEFINE IMAGELIST oImgList2 SIZE 32, 32
DEFINE IMGBITMAP OF oImgList2 NAME "internet" COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImgList2 NAME "keys" COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImgList2 NAME "quit" COLOR nRGB( 255, 0, 255 )
// Now we create the rebar
DEFINE REBAR oReBar OF oPanel
// Now we create the toolbars and add the buttons
DEFINE TOOLBAR oToolBar1 OF oReBar SIZE 50, 58 ;
IMAGELIST oImgList1
DEFINE TBBUTTON OF oToolBar1 ;
ACTION MsgInfo( "New" ) ;
TOOLTIP "New" ;
PROMPT "&New project"
/*
DEFINE TBBUTTON OF oToolBar1 ;
ACTION MsgInfo( "Open" ) ;
TOOLTIP "Open" ;
PROMPT "Open project"
DEFINE TBSEPARATOR OF oToolBar1
DEFINE TBMENU OF oToolBar1 ;
ACTION MsgInfo( "Search" ) ;
TOOLTIP "Search" ;
PROMPT "Search" ;
MENU BuildPopup()
*/
DEFINE TBBUTTON OF oToolBar1 ;
ACTION MsgInfo( "Print" ) ;
TOOLTIP "Print a report" ;
PROMPT "Print a report"
DEFINE TOOLBAR oToolBar2 OF oReBar SIZE 50, 50 ;
IMAGELIST oImgList2
DEFINE TBBUTTON OF oToolBar2 ;
ACTION MsgInfo( "Users" ) ;
TOOLTIP "Users management" ;
PROMPT "Users"
DEFINE TBSEPARATOR OF oToolBar2
DEFINE TBBUTTON OF oToolBar2 ;
ACTION oWnd:End() ;
TOOLTIP "End Application" ;
PROMPT "Exit"
@ 4,439 BUTTON oExtBtn PROMPT "Test" ;
SIZE 70,24 ;
ACTION If( Left( ProcName( 6 ), 6 ) == "TREBAR", MsgInfo( "Clicked" ), nil ) ;
OF oToolBar1 ;
PIXEL
// We set the widths for each toolbar
oToolBar1:nWidth = 200
oToolBar2:nWidth = 250
// Now we insert the toolbars into the rebar
oReBar:InsertBand( oToolBar1 )
oReBar:InsertBand( oToolBar2 )
DEFINE STATUSBAR OF oWnd PROMPT "Rebars and Toolbars test"
ACTIVATE WINDOW oWnd MAXIMIZED ON INIT (oPanel2:hide());
ON RESIZE (oPanel:nHeight := oWnd:nHeight(), oPanel:nwidth := oWnd:nwidth )
oImgList1:End()
oImgList2:End()
return nil
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "&Project"
MENU
MENUITEM "&New..." ACTION MsgInfo( "New" )
MENUITEM "&Open..." ACTION MsgInfo( "Open" )
SEPARATOR
MENUITEM "&Exit..." ACTION MsgInfo( "End" )
ENDMENU
MENUITEM "&Edit"
MENU
MENUITEM "&Search..." ACTION MsgInfo( "Search" )
MENUITEM "&Print..." ACTION MsgInfo( "Print" )
ENDMENU
MENUITEM "&Utilities"
MENU
MENUITEM "&Upgrade..." ACTION MsgInfo( "Upgrade" )
MENUITEM "&Users..." ACTION MsgInfo( "Users" )
ENDMENU
ENDMENU
return oMenu
function BuildPopup()
local oMenu
MENU oMenu POPUP
MENUITEM "One" ACTION MsgInfo( "One" )
MENUITEM "Two" ACTION MsgInfo( "Two" )
MENUITEM "Three" ACTION MsgInfo( "Three" )
ENDMENU
return oMenu
function f_tab(nOption,oPanel,oPanel2,oPanel3,oPanel4)
oPanel:hide()
oPanel2:hide()
if nOption=1
oPanel:show()
elseif nOption=2
oPanel2:show()
endif
return NIL
//---------------------------------------------------------------------------//