RibonBar.prg
- Code: Select all Expand view RUN
#include "FiveWin.ch"
static oRb
function Main()
local oWnd, oAct, oMenu, aControls := {}
DEFINE WINDOW oWnd TITLE "Visual RibbonBar"
@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd SIZE 0, 0
oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aControls ) }
oAct:Do( "AttachToWindow", oWnd:hWnd )
oRb = oAct:Do( "AddRibbonBar", "fwh" )
oMenu = oRb:Controls:Add( 2, 0, "Menu" )
oMenu:Flags = 1 && xtpFlagRightAlign
oTabs = oMenu:CommandBar:Controls:Add( 2, 0, "Tabs" )
AAdd( aControls, oTabs:CommandBar:Controls:Add( 1, 3000, "Add" ) )
oGroups = oMenu:CommandBar:Controls:Add( 3, 0, "Groups" )
AAdd( aControls, oGroups:CommandBar:Controls:Add( 1, 4000, "Add" ) )
ACTIVATE WINDOW oWnd
return nil
function RibbonBarEvent( cEvent, aParams, pParams, aControls )
local oTab
static nTab := 1, nGroup := 1
do case
case cEvent == "Execute" .and. Len( aControls ) > 0
do case
case aControls[ 1 ]:hObj == aParams[ 1 ]
oTab = oRb:InsertTab( nTab, "Tab " + AllTrim( Str( nTab++ ) ) )
oTab:Selected = .T.
case aControls[ 2 ]:hObj == aParams[ 1 ]
MsgInfo( "Insert Group" )
endcase
endcase
return nil